How to use the MONTH function
What is the MONTH function?
The MONTH function returns a number representing the month from an Excel date.
- 1 - January
- 2 - February
- 3 - March
- 4 - April
- 5 - May
- 6 - June
- 7 - July
- 8 - August
- 9 - September
- 10 - October
- 11 - November
- 12 - December
Table of Contents
1. Introduction
What is an Excel date?
Dates are stored numerically but formatted to display in human-readable date/time formats, this enables Excel to do work with dates in calculations.
For example, dates are stored as sequential serial numbers with 1 being January 1, 1900 by default. The integer part (whole number) represents the date the decimal part represents the time.
This allows dates to easily be formatted to display in many date/time formats like mm/dd/yyyy, dd/mm/yyyy and so on and still be part of calculations as long as the date is stored numerically in a cell.
You can try this yourself, type 10000 in a cell, press CTRL + 1 and change the cell's formatting to date, press with left mouse button on OK. The cell now shows 5/18/1927.
Why are dates actually integers in Excel?
This allows for calculations like adding or subtracting days to a given date. It also allows for easy formatting meaning you can customize the look of a given date by formatting the cell to your needs.
2. Syntax
MONTH(serial_number)
serial_number | Required. The date value you want to extract the month from. |
3. Example
The first example is in cell B3, it contains: 6/12/2023 which is an Excel date formatted like this mm/dd/yyyy. mm is the month number, dd is the day number, and yyyy is the four digit year in the Excel date.
Formula in cell C3:
The formula in cell C3 returns 6 which represents month "June". If we look at cell B3 we can see that 6 in 6/12/2023 is the month number.
The second example is in cell B4 which contains 3/13/2022.
Formula in cell C4:
The formula in cell C4 returns 3 which corresponds to month "March" which is the third month in a year.
The third example is in cell B5 which contains 10/14/2025.
Formula in cell C5:
The formula in cell C5 returns 10 which corresponds to month "October" which is the tenth month in a year.
To understand the MONTH function I need to explain that it needs an Excel date in order to calculate the month properly. The date in cell B3 is an Excel date meaning it is a number formatted as a date. 1 is 1/1/1900 and 1/1/2000 is 36526 meaning there are 36526 days between the dates.
You can verify this, select a cell containing 1/1/2000 and press CTRL + 1 to open the "Format Cells" dialog box.
The "Sample" shown in the image above demonstrates what the value changes to if you choose to format the cells using the category "General". The sample contains 36526 which is the number representing 1/1/2000.
4. MONTH Function alternative
The MONTH function returns a number that represents the month in a year based on a given date. The TEXT function allows you to format a string based on a given formatting code which is m, mm, mmm or mmmm. The differences between these codes are:
- m - month number without a leading zero. For example 6
- mm - month number with leading zero if smaller than 10. Based on the example in cell C3: 06
- mmm - the three first letters in the month name, for example, "Jun" which represents "June". Based on the example in cell C3: "Jun"
- mmm - the entire month name. Based on the example in cell C3: "June"
The example in cell C3 shows 6 based on date 6/12/2023, however, the output is different than the MONTH function. The output is a text string in contrast to the MONTH function which returns a number.
Formula in cell C3:
The formula in cell C3 returns "3", the double quotes represent that the output being a text string.
Explaining formula
Step 1 - TEXT function
The TEXT function lets you format values.
TEXT(value, format_text)
value - The string you want to format. You can use a cell reference here or use a text string.
format_text - Formatting code allowing you to change the way, for example, a date or a number is displayed to the Excel user.
Step 2 - Populate arguments
The TEXT function has two arguments.
value - B3
format_text - "m"
"m" is an abbreviation for month. A single "m" returns the number representing the position of a given month in a year.
Check out this article to learn more about formatting codes in the TEXT function.
Step 3 - Evaluate TEXT function
TEXT(B3, "m")
becomes
TEXT(45089, "m")
and returns 6. 6 represents the sixth month in a year which is "June".
5. MONTH function - return month name instead of a number
5.1 Example 1 - INDEX function
Formula in cell C3:
Explaining formula in cell C3
Step 1 - Calculate month number
MONTH(B3)
- 1 - January
- 2 - February
- 3 - March
- 4 - April
- 5 - May
- 6 - June
- 7 - July
- 8 - August
- 9 - September
- 10 - October
- 11 - November
- 12 - December
MONTH(B3)
becomes
MONTH(45089)
and returns 6. Number 6 represents "June".
Step 2 - Return corresponding month name
The INDEX function returns a value in a cell range or array based on a row and column number (optional).
INDEX(array, [row_num], [column_num], [area_num])
INDEX({"January"; "February"; "March"; "April"; "May"; "June"; "July"; "August"; "September"; "October"; "November"; "December"},MONTH(B3))
becomes
INDEX({"January"; "February"; "March"; "April"; "May"; "June"; "July"; "August"; "September"; "October"; "November"; "December"}, 6)
and returns "June". "June" is the sixth month in a year.
5.2 Example 2 - TEXT function
Formula in cell C4:
Explaining formula in cell C4
The TEXT function lets you format values.
TEXT(value, format_text)
value - The string you want to format. You can use a cell reference here or use a text string.
format_text - Formatting code allowing you to change the way, for example, a date or a number is displayed to the Excel user.
Formatting code "mmmm" evaluates to the month name.
TEXT(B4, "mmmm")
becomes
TEXT(44603, "mmmm")
and returns "March".
5.3 Example 3 - Cell formatting
You can also show the month name using cell formatting, the image above demonstrates cell formatting applied to cell C5.
How to apply cell formatting:
- Select cell C5.
- Press CTRL + 1 to open the "Format Cells" dialog box.
- Press with left mouse button on "Category" Custom, see the image above.
- Enter mmmm below Type:
- Press with left mouse button on OK button to apply cahnges.
6. Filter dates based on month
Formula in cell D3:
Explaining formula
Step 1 - Calculate month number for each date value
MONTH(B3:B11)
becomes
MONTH({44667; 44667; 44700; 44707; 45006; 45051; 45054; 45075; 45079})
and returns {4; 4; 5; 5; 3; 5; 5; 5; 6}.
Step 2 - Compare month number to condition
The equal sign lets you check if values are equal, note that this does not perform a case-sensitive comparison. Check out the EXACT function if upper and lower letters matter.
MONTH(B3:B11)=5
becomes
{4; 4; 5; 5; 3; 5; 5; 5; 6}=5
and returns
{FALSE; FALSE; TRUE; TRUE; FALSE; TRUE; TRUE; TRUE; FALSE}
Step 3 - Extract dates meeting the condition
The FILTER function is a new function available to Excel 365 subscribers. It lets you extract values based on a condition or criteria.
FILTER(array, include, [if_empty])
FILTER(B3:B11, MONTH(B3:B11)=5)
becomes
FILTER({44667; 44667; 44700; 44707; 45006; 45051; 45054; 45075; 45079}, {FALSE; FALSE; TRUE; TRUE; FALSE; TRUE; TRUE; TRUE; FALSE})
and returns {44700; 44707; 45051; 45054; 45075}.
7. MONTH Function not working
Check your spelling, the image above shows the MONTH function misspelled. An #NAME? error is shown in cell C3.
Cell B3 contains a text value and not a proper Excel date, this returns a #VALUE! error in cell C3.
'MONTH' function examples
Table of Contents Automate net asset value (NAV) calculation on your stock portfolio Calculate your stock portfolio performance with Net […]
Table of Contents Count cells containing text from list Count entries based on date and time Count cells with text […]
This article describes how to count unique distinct values. What are unique distinct values? They are all values but duplicates are […]
Functions in 'Date and Time' category
The MONTH function function is one of 22 functions in the 'Date and Time' category.
How to comment
How to add a formula to your comment
<code>Insert your formula here.</code>
Convert less than and larger than signs
Use html character entities instead of less than and larger than signs.
< becomes < and > becomes >
How to add VBA code to your comment
[vb 1="vbnet" language=","]
Put your VBA code here.
[/vb]
How to add a picture to your comment:
Upload picture to postimage.org or imgur
Paste image link to your comment.
Contact Oscar
You can contact me through this contact form