ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   a moth before (https://www.excelbanter.com/excel-programming/273036-moth-before.html)

John[_40_]

a moth before
 
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

Paul B[_6_]

a moth before
 
John this should do it =DATE(YEAR(TODAY()),MONTH(TODAY())-1,DAY(TODAY()))

--
Paul B
Always backup your data before trying something new
Using Excel 2000 & 97
Please post any response to the newsgroups so others can benefit from it
** remove news from my email address to reply by email **
"John" wrote in message
...
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




JMay

a moth before
 
=EOMONTH(B4,-1)
Also Format, Cell, Custom "mmmm"
HTH

"John" wrote in message
...
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




Gnasher

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.


All times are GMT +1. The time now is 02:13 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com