View Single Post
  #12   Report Post  
Posted to microsoft.public.excel.programming
Robert McCurdy Robert McCurdy is offline
external usenet poster
 
Posts: 102
Default Formula to return Friday's date: m/d/yyyy

=A1+MOD(138612,WEEKDAY(A1)+6)

I first thought it was just a large date that started on a Thursday, dang if I can figure this one out. Anyway it don't add 7 if A1
is a Friday, it adds zero.
Here is a slight modification on my last post.

=7*(MOD(A2,7)5)-MOD(A2,7)+A2+6


Regards Robert

"JMay" wrote in message news:yovic.18727$VQ3.15219@lakeread06...
Dana,
Just curious but how did you derive the number 138612?
I see that it is the Key to this approach!!
TIA,


"Dana DeLouis" wrote in message
...
Just another option:

=A1+MOD(138612,WEEKDAY(A1)+6)

--
Dana DeLouis
Using Windows XP & Office XP
= = = = = = = = = = = = = = = = =


"Austin M. Horst" wrote in message
...
I'm trying to write a formula to return this Friday's date (Format

m/d/yyyy).
If it's a Saturday, I want next weeks Friday to be displayed.

The following works, but takes 7 cells (each formula is in a different

cell).
I would like to combine the following into one formula.

=IF(WEEKDAY(NOW())=1,TODAY()+5,"")
=IF(WEEKDAY(NOW())=2,TODAY()+4,"")
=IF(WEEKDAY(NOW())=3,TODAY()+3,"")
=IF(WEEKDAY(NOW())=4,TODAY()+2,"")
=IF(WEEKDAY(NOW())=5,TODAY()+1,"")
=IF(WEEKDAY(NOW())=6,TODAY()+0,"")
=IF(WEEKDAY(NOW())=7,TODAY()+6,"")

Value returned: 4/30/2004

If I join each line together with an "&" the date is retuned in decimal

value, not m/d/yyyy.
The "number format" of the cell is Category: Date | Type: m/dd/yyy
(The following is all on one line in my sheet, I broke it up here to

make
it easier to see)

=IF(WEEKDAY(NOW())=1,TODAY()+5,"")&
IF(WEEKDAY(NOW())=2,TODAY()+4,"")&
IF(WEEKDAY(NOW())=3,TODAY()+3,"")&
IF(WEEKDAY(NOW())=4,TODAY()+2,"")&
IF(WEEKDAY(NOW())=5,TODAY()+1,"")&
IF(WEEKDAY(NOW())=6,TODAY()+0,"")&
IF(WEEKDAY(NOW())=7,TODAY()+6,"")

Value returned: 38107

Maybe there is a better way to write this.
Any ideas?

Thanks,
Austin M. Horst







---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.659 / Virus Database: 423 - Release Date: 16/04/2004