Previous Month

  • Thread starter Thread starter Wercs
  • Start date Start date
W

Wercs

Hi,

I wish to calculate the previous month from a given date.

i.e. In D1 I have todays date, as =TODAY()
In D9 I wish to show last months name. I have that cell formatted
as <Custom>/<mmmm>

If I use =SUM(D1)-1, it displays as August, not July. To get July I have to
work in days, i.e =SUM(D1)-31

I can see a problem here when it approaches the end of a month.

I'm sure it must be possible to work in months instead of days, but I'm
probably missing something very obvious.
Help appreciated.

TIA.
 
Hi
try
=DATE(YEAR(TODAY()),MONTH(TODAY())-1,1)

or if TODAY() is stored in D1:
=DATE(YEAR(D1),MONTH(D1)-1,1)
 
Hi,

I wish to calculate the previous month from a given date.

i.e. In D1 I have todays date, as =TODAY()
In D9 I wish to show last months name. I have that cell formatted
as <Custom>/<mmmm>

If I use =SUM(D1)-1, it displays as August, not July. To get July I have to
work in days, i.e =SUM(D1)-31

I can see a problem here when it approaches the end of a month.


=D1-DAY(D1)

will give the last day of the previous month


--ron
 
Back
Top