How do I test if the weekday is between Monday and Friday ?

G

Guest

Hello everyone,

How could I test in Excel that the weekday is between Monday and Friday, in
other words, the weekday can only be: Monday, Tuesday, Wednesday, Thursday
and Friday.

Thanks very much
Tom
 
N

Niek Otten

Hi Tom,

=AND(WEEKDAY(A1)>1,WEEKDAY(A1)<7)

Returns TRUE or FALSE

--
Kind regards,

Niek Otten
Microsoft MVP - Excel

| Hello everyone,
|
| How could I test in Excel that the weekday is between Monday and Friday, in
| other words, the weekday can only be: Monday, Tuesday, Wednesday, Thursday
| and Friday.
|
| Thanks very much
| Tom
 
G

Guest

Not sure if this is a *programming* question...

The testing part is fairly easy:

This formula returns TRUE if the date in A! is a Monday thru Friday. FALSE
if a weekend:
=WEEKDAY(A1,2)<6

(Note: you can also use the WEEKDAY function in VBA)

Does that get you headed in the right direction?

***********
Regards,
Ron

XL2002, WinXP
 
G

Guest

Hi Niek and Ron,

thanks very much for your quick answer. What should A1 contain please ? in
my case, A1 should be the today day: "Monday", "tuesday", "wednesday",
"thursday" or "friday".
Does the condition you mentioned still work ?
Please help
Thanks very much and regards
Tom
 
G

Guest

If A1 is a text entry (Monday, Tuesday, etc)....

Here's something to try:
B1:
=SUM(COUNTIF(A1,{"Saturday","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday"})*{1,2,3,4,5,6,7})>2

Note: In case text wrap impacts the display, there are NO spaces in that
formula

Does that help?

***********
Regards,
Ron

XL2002, WinXP
 
G

Guest

A shorter alternative:

=SUM(COUNTIF(A1,TEXT("12/30/2005"+{1,2,3,4,5,6,7},"dddd"))*{1,2,3,4,5,6,7})>2

***********
Regards,
Ron

XL2002, WinXP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top