How to Convert Between Month Name & Number in Google Sheets

There are several ways to convert between month names and numbers in Google Sheets. Let's explore a few methods.

Method 1: Using the MONTH and DATE functions

  1. Convert month name to month number:
    • Formula: =MONTH(DATEVALUE("MonthName&" 1"))
    • Replace "MonthName" with the actual month name or the cell reference containing the month name.
  2. Convert month number to month name:
    • Formula: =TEXT(DATE(2022, MonthNumber, 1), "MMMM")
    • Replace "MonthNumber" with the actual month number or the cell reference containing the month number.

Method 2: Using the SWITCH function

  1. Convert month name to month number:
    • Formula: =SWITCH(MONTH_NAME, "January", 1, "February", 2, "March", 3, "April", 4, "May", 5, "June", 6, "July", 7, "August", 8, "September", 9, "October", 10, "November", 11, "December", 12)
    • Replace MONTH_NAME with the actual month name or the cell reference containing the month name.
  2. Convert month number to month name:
    • Formula: =SWITCH(MONTH_NUMBER, 1, "January", 2, "February", 3, "March", 4, "April", 5, "May", 6, "June", 7, "July", 8, "August", 9, "September", 10, "October", 11, "November", 12, "December")
    • Replace MONTH_NUMBER with the actual month number or the cell reference containing the month number.

Example

Let's say we have a month name in cell A1 and a month number in cell B1. Here's how to convert them using the MONTH and DATE functions:

  1. Convert month name (A1) to month number:
    • Formula in cell C1: =MONTH(DATEVALUE(A1&" 1"))
  2. Convert month number (B1) to month name:
    • Formula in cell D1: =TEXT(DATE(2022, B1, 1), "MMMM")

Now, let's convert them using the SWITCH function:

  1. Convert month name (A1) to month number:
    • Formula in cell E1: =SWITCH(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. Convert month number (B1) to month name:
    • Formula in cell F1: =SWITCH(B1, 1, "January", 2, "February", 3, "March", 4, "April", 5, "May", 6, "June", 7, "July", 8, "August", 9, "September", 10, "October", 11, "November", 12, "December")
Did you find this useful?