Get previous month number

sharky12345

Well-known Member
Joined
Aug 5, 2010
Messages
3,404
Office Version
  1. 2016
Platform
  1. Windows
I'm using this to get the Month number;

=MONTH(DATEVALUE(U2&" 1"))

Can anyone show me how to get the number of the previous month, so that if the Month is January it would show 12?
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
Andrew, U2 contains the month name only from a Data Validation list - your suggestion produces '#VALUE!'
 
Upvote 0
What version of Excel do you have? Prior to Excel 2007 EDATE was in the Analysis ToolPak Add-In, which must be installed.
 
Upvote 0
Ah, sorry - I normally use 2007 but I'm doing a project for someone who is using 2003 so developing it in that version.
 
Upvote 0
This formula should work in XL2003 and above...

=MONTH((U2&1)-DAY(U2&1))
 
Upvote 0
Perfect, thanks Rick, and thank you to Andrew for his perseverance!
 
Upvote 0

Forum statistics

Threads
1,214,636
Messages
6,120,664
Members
448,976
Latest member
sweeberry

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