Day of week referenced in if statement

B

Bert

I need a formula that will look at a date in a cell and
if the date occurs on any weekday(Mon - Fri), to return
the date in the cell, if not return a zero. I am stumped.

Thanks
 
P

Peo Sjoblom

One way

=(WEEKDAY(A1,2)<6)*1

No need for an IF function in this case

Regards,

Peo Sjoblom
 
B

Biff

Hi!

Here's one way. Assume the weekdays are counted as Monday
= 1 and Sunday = 7. Date is in cell A7:

=IF(WEEKDAY(A7,2)<=5,A7,0)

Format as DATE.

Biff
 
A

AK

life is great, learning new things all the time, didn't know about the
various weekday (sets?)

very cool
 
B

Biff

Hi!

There are 3 different options for weekdays. See the
WEEKDAY function help for more info.

Biff
 
P

Peo Sjoblom

Oops! Must have looked at another question at the same time
However, that is easily fixed

=(WEEKDAY(A1,2)<6)*A1

however both your and my formulas return 01/00/00
if formatted as dates when the formula returns zero for weekends, so I'd
suggest a
custom format m/d/yy;;"0"

--
Regards,

Peo Sjoblom

(No private emails please, for everyone's
benefit keep the discussion in the newsgroup/forum)
 

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