Thread: a moth before
View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Gnasher Gnasher is offline
external usenet poster
 
Posts: 1
Default a moth before

In article ,
says...
I need to have a cell that shows a moth before today
=today () 'it shows 30-july
i need to have = June
How ca do it?
Thanks
John

Neither of the above quite give you what I suspect you want. But putting
the two ideas together seems to work and copes with leap years as well:

=DATE(YEAR(A6),MONTH(A6)-1,MIN(DAY(A6),DAY(EOMONTH(A6,-1))))

Where A6 is the original date cell.

This gives the desired transformation when the previous month is shorter
than the current one:

30-Jul-03 - 30-Jun-03
31-Jul-03 - 30-Jun-03

Suck and see.