Spreadsheet Practice

How to convert a month name to a number in Excel

Formula (Excel and Google Sheets)

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

Turn the name into a date and take its month: =MONTH(DATEVALUE(A2&" 1")).

Result on the example
one result per row in B2, filled down to B6
Works in
Every current version
Google Sheets
Same formula

See it work

The formula is already in B2, filled down to B6. Change any input and the result updates, or edit the formula to experiment.

How it works

Joining " 1" turns "March" into "March 1", which DATEVALUE reads as March 1 of the current year. MONTH then returns its month number. Full names and three-letter abbreviations both work.

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

Result3

  1. A2"March"

    The value in A2.

  2. A2&" 1""March 1"

    The & operator joins as text.

  3. DATEVALUE(A2&" 1")3/1/2026 (46082)

    DATEVALUE: Converts date text to a date.

    • date_textA2&" 1""March 1"
  4. MONTH(DATEVALUE(A2&" 1"))3

    MONTH: Month of a date, 1–12.

    • serial_numberDATEVALUE(A2&" 1")3/1/2026 (46082)

In Google Sheets

The same formula works in Google Sheets: =MONTH(DATEVALUE(A2&" 1")). We ran it in Google Sheets mode on the same data and it returns the same results.

Other ways to do it

Each one was run on the same example sheet.

FormulaResultWhen to use it
=MATCH(LEFT(A2,3),{"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"},0)3, 9, 12…Looks up the first three letters, so it doesn't depend on date parsing.
=MONTH(A2&" 1")3, 9, 12…Shorter: MONTH converts the text itself.

Common mistakes

  • Month names must be in the spreadsheet's language: "Mars" fails in an English locale.
  • Extra spaces or "Sept." may not parse. TRIM the text, or use the MATCH version on the first three letters.

Try it yourself

Same data, empty answer cell. Your formula is graded instantly, then re-checked on changed data, so a typed-in number won't pass.

Convert a month name to a number

In B2, return the month number (1 to 12) for the month name in A2, and fill down to B6.

Questions

How do I convert a month number to a name?

=TEXT(DATE(2026,A2,1),"mmmm").

How do I sort month names in calendar order?

Sort by the number: =SORTBY(A2:A6,MONTH(A2:A6&" 1"),1).

Checked by running on 2026-10-30: every formula and result on this page was calculated by the Spreadsheet Practice formula engine, in both Excel and Google Sheets modes.