Logic Error on If formula

W

Wendy

Hi

I have a formula which should produce yesterdays data if today is
tues,wed,thur or fri, if today is monday it should produce fridays data, and
sometimes there isn't any data at all.

IIf(Weekday(Date()=1),Date()-3,Date()-1)
this method works if today is monday.

IIf(Weekday(Date()=1),Date()-1,Date()-3)
this method works if its tues, wed, thur or fri

Is it possible to get it working for everyday?

Thanks

Wendy
 
P

Pieter Wijnen

Parenthises, Parenthises..

IIf(Weekday(Date(),2)=1,Date()-3,Date()-1) ' 2 = to denote Monday as
firstdayofweek = vbMonday
 
P

Pieter Wijnen

Parenthises, Parenthises..

IIf(Weekday(Date(),2)=1,Date()-3,Date()-1) ' 2 = to denote Monday as
firstdayofweek = vbMonday


Wendy said:
Hi

I have a formula which should produce yesterdays data if today is
tues,wed,thur or fri, if today is monday it should produce fridays data,
and
sometimes there isn't any data at all.

IIf(Weekday(Date()=1),Date()-3,Date()-1)
this method works if today is monday.

IIf(Weekday(Date()=1),Date()-1,Date()-3)
this method works if its tues, wed, thur or fri

Is it possible to get it working for everyday?

Thanks

Wendy



--
 
W

Wendy

Thanks, I often get muddled up on how many I actually need!

Wendy

"Pieter Wijnen"
<it.isi.llegal.to.send.unsollicited.mail.wijnen.nospam.please@online.replace
..with.norway> wrote in message news:[email protected]...
 

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