Sometimes when working in Google Sheets, you may want to convert a month name to a number.
For example, maybe you have a cell that contains a month like “September” and you would like to use a formula to quickly convert this into the number 9 that represents the month.
This can be done pretty easily if you use the right formulas.
In this tutorial, I will show you how to convert a month name to a number in Google Sheets.
Table of Contents
Month Name to Number Using MONTH Function
One of the easiest ways to convert a month name to a number in your spreadsheet is to use the MONTH function.
The MONTH function will take a date and return the number representing the month of that date.
Here is an example:
As you can see from the above example, all you need to do is put the date into the function and it will return the month number.
Now the only problem with this function is that it won’t return a number if you only have the text of the month in a cell.
Here is what I mean by this:
You can see in the example above, it returns a #VALUE error because the month number needs either a date or a number to work, so the text representing the month won’t work with this function.
To get around this we need to make one simple change to our formula.
Here is the syntax we will use to convert the month name to the month number:
By adding “&1” into the formula, this puts the month into a date which the MONTH function can then read to convert to the month number.
Here is an example:
Convert Month Name to Number with IFS Function
Another option is to use the IFS function to convert the month name to a number.
Here is the formula that will do this:
This method will check your cell to see if it is equal to the first month, if it is not it will continue to run through each month until it finds the match, and return the number associated with it.
I have now shown 2 methods for turning the month name into a number.
The first method is definitely easier, and I would recommend this first if you’re looking for a quick way to do this.
If you’re comfortable with the IFS function you may favor the second method, but this formula takes much longer to type out.