Calculate Future Date

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

This is what I have so far...

=Format(DateAdd("d",7-Weekday(Date(),6),Date()+7),"mm/dd/yy")

What I need is for it to calculate the next thursdays date. So if today was
Wed then I would need the date for the next day. If today was Thur then I
would need the date for next Thur.

The above calculation gives me the date for Thur but 2 weeks in the future.
 
Hello "AirgasRob".
AirgasRob said:
This is what I have so far...

=Format(DateAdd("d",7-Weekday(Date(),6),Date()+7),"mm/dd/yy")

What I need is for it to calculate the next thursdays date. So if
today was Wed then I would need the date for the next day.
If today was Thur then I would need the date for next Thur.

The above calculation gives me the date for Thur but 2 weeks in
the future.

The Weekday function returns a value between 1 and 7, 1 is returned
for the weekday you passed as parameter.
From the day next week, you want to subtract 0 if it's a thursday,
1 if it's a friday, ... 6 if it's a wednesday. The number we want
to subtract is 1 less than the weekday function for thursdays (5).
Therefore, we are looking for:

=Date()+7-(Weekday(Date(),5)-1), or in other words (formatted):
=Format(DateAdd("d",8-Weekday(Date(),5),Date()),"mm/dd/yy")
 
AirgasRob said:
This is what I have so far...

=Format(DateAdd("d",7-Weekday(Date(),6),Date()+7),"mm/dd/yy")

What I need is for it to calculate the next thursdays date. So if today was
Wed then I would need the date for the next day. If today was Thur then I
would need the date for next Thur.


DateAdd("d",8-Weekday(Date(),5),Date())
 
Brilliant thank you very much!

I must admit I was unable to make Dave's solution work, not quite to that
level yet. But Wolfgang and Marshall's solution works very well for what I
need. Again thank you to all that answered.
 
Back
Top