months on report

  • Thread starter Thread starter Alex
  • Start date Start date
A

Alex

I'm trying to show on my report the names of the last 6
months.

When I use this
=Format((Year(Date()),Month(Date())-6,1),"mmm")
for the 6th before current month, it shows nothing.
When I use the following
=Format(Month(Date())-6,"mmm") it shows Dec (but it should
be Jan) and for the rest of months =Format(Month(Date())-
5,"mmm") ... it shows Jan.

Could you advise what formula I could use?

Thanks
 
=Format(DateAdd("m",-6,Date()),"mmm")

Or

=Format(DateSerial(Year(Date()),Month(Date())-6,1),"mmm")

Your method was getting the Month number (1-12) and then subtracting from that.
That was giving you a date in December 1899 or January 1900, since dates are
just the number of days from ???December 30, 1899???
 
Thanks a lot, John.
It's working perfectly.
-----Original Message-----
=Format(DateAdd("m",-6,Date()),"mmm")

Or

=Format(DateSerial(Year(Date()),Month(Date())-6,1),"mmm")

Your method was getting the Month number (1-12) and then subtracting from that.
That was giving you a date in December 1899 or January 1900, since dates are
just the number of days from ???December 30, 1899???

.
 
Back
Top