To turn a month name into its number, build a date from it and extract the month: =MONTH(DATEVALUE(A1&" 1")) returns 3 for “March” and works with “Mar” too. The &” 1″ adds a day so DATEVALUE has something valid to parse.
If DATEVALUE gives #VALUE! — which happens on some regional settings — use MATCH against a list instead: =MATCH(A1,{"January","February","March","April","May","June","July","August","September","October","November","December"},0). That’s the more portable option since it doesn’t depend on your system’s date settings, though it needs a separate version for abbreviations.
For a list that might contain either form, =MATCH(LEFT(A1,3),{"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"},0) handles both by matching on the first three letters. And to go the other way — number to name — use =TEXT(DATE(2026,A1,1),"mmmm").
Say you’re an event planner and receive a list of events and the months they’re scheduled for, like “March” for a spring festival. Now, your budget Excel sheet uses month numbers instead of names.
In Excel, you can convert a month name, like “March”, into “3” and “October” into “10” using multiple formulas.
To convert a month’s name into the month’s number, you need to create a date with that month’s name using a DATEVALUE function and then use the MONTH function to get the number of the month.
Formula to Get the Month Number from the Month Name
In this formula, you need to combine MONTH and DATEVALUE functions. With this, you can take the month name and create a date, and then get the month number from that date into a cell.

To write this formula, you can use the below steps:
- First, enter the DATEVALUE function in a cell. After that, you need to enter “01”. Next, use an ampersand and refer to the cell where you have the month’s name.
- Now, again use an ampersand and enter “1900”.
- In the end, wrap the MONTH function around the DATEVALUE and hit enter to get the result.
=MONTH(DATEVALUE("01"&A1&"1900"))
To understand this formula, you can break it down into two parts. In the FIRST part, you have the DATEVALUE, which helps you to create a valid date using the month name. You have 01, January, and 1900 and DATEVALUE creates the date 01-Jan-1900.

In the SECOND part, the MONTH function returns the month number from the date returned by the DATEVALUE.

The benefit of using this formula is that it works with both forms of the month name: if you have the month in the full form, like “January” instead of “Jan”, this formula will still work.
There’s one thing to keep in mind: DATEVALUE reads the month name in the language of your Windows or Mac date settings. So, with English month names on a computer set to another language, the formula returns #VALUE!. In that case, use one of the MATCH formulas below, as they don’t depend on the date settings.

Convert Month Name into a Number with MATCH
MATCH helps you find an item’s position in a list. You provide the item you’re looking for and the list where the formula searches.
Excel then tells you where in the list (like the first, second, third spot, etc.) that item appears.
=MATCH(A1, {"January","February","March","April","May","June","July","August","September","October","November","December"}, 0)
=MATCH(A1, {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}, 0)
Here, A1 contains the month name. The MATCH function searches for the month name within the array of all month names and returns its position (i.e., the month number).
MATCH returns the position of the month name in the list, which is the same as the month number. The same thing can also be achieved by combining CHOOSE with MATCH. See the formula below:
=CHOOSE(MATCH(A1, {"January","February","March","April","May","June","July","August","September","October","November","December"}, 0), 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12)
And here’s one more formula that uses a combination of MATCH + ISNUMBER + SEARCH. As SEARCH looks for the short name inside the cell, it works with both “Mar” and “March”.
=MATCH(TRUE, ISNUMBER(SEARCH({"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"}, A1)), 0)
A simpler way to handle full names, short names and even “Sept” in one formula is to take the first three letters of the cell with LEFT and match them against the short names. MATCH isn’t case-sensitive, so “december” works as well:
=MATCH(LEFT(A1,3),{"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"},0)
Get Month Number from Name with VLOOKUP
Yes, you can also use VLOOKUP with an array of all the month names and their numbers, and look up the name to get that month’s number.
=VLOOKUP(A1, {"January",1; "February",2; "March",3; "April",4; "May",5; "June",6; "July",7; "August",8; "September",9; "October",10; "November",11; "December",12}, 2, FALSE)
As I said, it helps you find the month’s number from its name.
You enter a month name into cell A1, like “March”. Excel then looks through a predefined list where each month’s name is paired with its number. It finds “March” and returns “3,” the number for March.
=VLOOKUP(A1, {"Jan",1; "Feb",2; "Mar",3; "Apr",4; "May",5; "Jun",6; "Jul",7; "Aug",8; "Sep",9; "Oct",10; "Nov",11; "Dec",12}, 2, FALSE)
Use XLOOKUP to Get the Month Number from a Name
XLOOKUP helps you find a value from a list or table. You can specify the lookup value, where to look for it, and what corresponding information to return in the result.
=XLOOKUP(A1, TEXT(DATE(0, SEQUENCE(12), 1), "mmmm"), SEQUENCE(12))
Like other formulas, this formula helps you convert the month name into a number.
When you type a month name into cell A1, like “July”, it looks at a list it creates of all month names (from January to December) using TEXT(DATE(0, SEQUENCE(12), 1), “mmmm”) and matches the name you have in cell A1. XLOOKUP and SEQUENCE are available in Excel 2021, Excel 2024 and Microsoft 365, not in Excel 2019 or older.
In the end, it shows the corresponding month number, so if you have “July”, it will return “7”.
Create a Custom Function for Month Name to Number
If you are someone who doesn’t want to write formulas again and again, you can use the macro below to create a custom function that takes a month name (short or long) and converts it into a number.
Function MonthNameToNumber(monthName As String) As Integer ' This function converts a full month name or its abbreviation to the corresponding month number. ' Convert the input to proper case to standardize comparisons monthName = Application.WorksheetFunction.Proper(monthName) ' Use Select Case to determine the month number based on monthName Select Case monthName Case "January", "Jan" MonthNameToNumber = 1 Case "February", "Feb" MonthNameToNumber = 2 Case "March", "Mar" MonthNameToNumber = 3 Case "April", "Apr" MonthNameToNumber = 4 Case "May" MonthNameToNumber = 5 Case "June", "Jun" MonthNameToNumber = 6 Case "July", "Jul" MonthNameToNumber = 7 Case "August", "Aug" MonthNameToNumber = 8 Case "September", "Sep" MonthNameToNumber = 9 Case "October", "Oct" MonthNameToNumber = 10 Case "November", "Nov" MonthNameToNumber = 11 Case "December", "Dec" MonthNameToNumber = 12 Case Else ' Return 0 if the monthName is not recognized MonthNameToNumber = 0 End Select End Function
To use this custom function:
- Press ALT + F11 to open the VBA editor.
- Go to Insert > Module to create a new module.
- Paste the code there and close the VBA editor.
Now, you can use this function just like any other Excel function. If you have a month name in cell A1, you can type =MonthNameToNumber(A1) in another cell to get the result. It returns 0 when the name isn’t recognized, and you need to save the file as a macro-enabled workbook (.xlsm) to keep the function.
Which Formula is the Best?
The best formula to convert a month name to a month number depends on your situation, but if you ask me, there are two methods that I have found the best:
- MONTH and DATEVALUE
- Custom Function with VBA
And if your computer uses a language other than English for dates, go with the MATCH and LEFT formula, as it works the same everywhere.
Frequently Asked Questions
Why does my month name formula return #VALUE!?
The DATEVALUE formula can’t read the name, either because it has a typo or extra spaces, or because your date settings use another language. Wrap the cell in TRIM, or use the MATCH and LEFT formula instead.
How do I convert a month number back to a name?
Create a date with that month and format it as text. For example, with 3 in A1, this returns “March” (use “mmm” for “Mar”):
=TEXT(DATE(2024,A1,1),"mmmm")
Does the result come as a number or text?
All the formulas on this page return a real number from 1 to 12, so you can use the result in other formulas, like DATE, or sort by it.
Written by
Puneet Gogia
Microsoft MVP — Excel · Founder, Excel Champs
Twelve years of teaching Excel, and a decade before that using it as a data analyst. Every tutorial here is written from a file I actually built.