Get previous month number

sharky12345

Well-known Member
Joined
Aug 5, 2010
Messages
3,380
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

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.

sharky12345

Well-known Member
Joined
Aug 5, 2010
Messages
3,380
Office Version
  1. 2016
Platform
  1. Windows
Andrew, U2 contains the month name only from a Data Validation list - your suggestion produces '#VALUE!'
 
Upvote 0

Andrew Poulsom

MrExcel MVP
Joined
Jul 21, 2002
Messages
73,092
ADVERTISEMENT
My formula can't return #VALUE! unless yours does.
 
Upvote 0

Andrew Poulsom

MrExcel MVP
Joined
Jul 21, 2002
Messages
73,092
ADVERTISEMENT
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

sharky12345

Well-known Member
Joined
Aug 5, 2010
Messages
3,380
Office Version
  1. 2016
Platform
  1. Windows
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

Rick Rothstein

MrExcel MVP
Joined
Apr 18, 2011
Messages
38,154
Office Version
  1. 2019
  2. 2010
Platform
  1. Windows
This formula should work in XL2003 and above...

=MONTH((U2&1)-DAY(U2&1))
 
Upvote 0

sharky12345

Well-known Member
Joined
Aug 5, 2010
Messages
3,380
Office Version
  1. 2016
Platform
  1. Windows
Perfect, thanks Rick, and thank you to Andrew for his perseverance!
 
Upvote 0

Forum statistics

Threads
1,195,949
Messages
6,012,481
Members
441,701
Latest member
vnkendijs

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
Top