Previous month based on current month

spectraflame

Well-known Member
Joined
Dec 18, 2002
Messages
830
Office Version
  1. 365
Platform
  1. Windows
I am using the following formula to return the current month.

=TEXT(TODAY(),"MMMM")

However I would like to return the previous month. I know that if it were the year, I can just add -1 to the end of the formula, but that returns #VALUE when tried with the MMMM format.

Thanks,
Matthew
 
A very simple solution is Text(A2-28,"mmmm")
A2 refers to the cell where date is.
Or Text(Now()-28, "mmmm")

-28 is to get to prior month adjusting for February, since date does not matter, we just extract the right month.
This avoids lots of checks for Jan/ December, or trickery on formulas.
 
Upvote 0

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
A very simple solution is Text(A2-28,"mmmm")
A2 refers to the cell where date is.
Or Text(Now()-28, "mmmm")

-28 is to get to prior month adjusting for February, since date does not matter, we just extract the right month.
This avoids lots of checks for Jan/ December, or trickery on formulas.
I don't remember this thread in detail, but a quick review seems to indicate a desire to get the previous month's name. For the formula you posted, if NOW() is the 29th, 30th, or 31st of a month, subtracting 28 will return the current month name, not the previous month's name.
 
Upvote 0

Forum statistics

Threads
1,222,642
Messages
6,167,267
Members
452,107
Latest member
cami_dev

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top