How to use the MONTH function
The MONTH function extracts the month as a number 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. MONTH Function Syntax
MONTH(serial_number)
2. MONTH Function Arguments
serial_number | Required. The date value you want to extract the month from. |
3. 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.
4. MONTH Function example
Formula in cell C3:
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.
5. MONTH Function alternative
Formula in cell C3:
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".
6. MONTH function - return month name instead of a number
6.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.
6.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".
6.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.
7. 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}.
'MONTH' function examples
The following 28 articles contain the MONTH function.
Introduction In this post I am creating a spreadsheet that will calculate stock portfolio performance. To do this I am […]
Brad asks: I'm trying to use your formulas to create my own bill reminder sheet. I envision a workbook where […]
The formula in cell C3 calculates the last date for the given month and year in cell B3. =DATE(YEAR(B3), MONTH(B3)+1, […]
This article describes how to build a calendar showing all days in a chosen month with corresponding scheduled events. What's […]
This article demonstrates a macro that changes y-axis range programmatically, this can be useful if you are working with stock […]
Janib Soomro asks: In A column, there are dates in mmddyyy format and in B column, there are two variables […]
The formula in cell D18 counts unique distinct months in cell range B3:B16. Formula in D18: =SUMPRODUCT((FREQUENCY(DATE(YEAR($B$3:$B$16), MONTH($B$3:$B$16), 1), DATE(YEAR($B$3:$B$16), […]
The array formula in cell E3 counts unique distinct items for all dates within the same week. Example, week 2 […]
The drop down calendar in the image above uses a "calculation" sheet and a named range. You can copy the drop-down […]
I will demonstrate three different techniques to build monthly date ranges in this article. Two of these techniques are easy because they […]
I will demonstrate three different methods to build quarterly date ranges in this article. The two first methods have a […]
This article demonstrates a formula that creates date ranges based on a given number of days and the end date […]
Sam asks: One more question for the Calendar that you have set up above can we have a excel formula […]
Excel has a built-in feature that allows you to highlight dates if a given condition is met. Section 1 below […]
The image above demonstrates a conditional formatting formula that highlights duplicate items based on date. The first instance is not highlighted, […]
This article demonstrates how to highlight given date ranges in a yearly calendar, this calendar allows you to change the […]
Color odd months Conditional formatting formula: =MOD(MONTH($B6),2) Explaining CF formula in cell B6 Step 1 - Calculate number of month The […]
If you study a stock chart you will discover that sometimes significant trend reversals happen when a stock chart […]
The image above shows rows highlighted based on value in column C being the largest or smallest in that particular […]
The image above shows the performance across industry groups for different date ranges, conditional formatting makes the table much easier […]
This article demonstrates a formula that extracts unique distinct records/rows for a given month specified in cell C2, see the […]
This article shows a formula that performs a reverse lookup and returns the corresponding value based on the last matching […]
I have created another monthly calendar template for you to get. Select a month and year in cells A1 and […]
This article demonstrates how to build a calendar in Excel. The calendar is created as a Pivot Table which makes […]
I will in this article demonstrate a calendar that automatically highlights dates based on date ranges, the calendar populates names […]
The array formula in cell B15 extracts dates from B4:B12 if it is not a duplicate item in the same […]
Below is an excel table containing recurring expenses and corresponding amounts, dates and recurring intervals. An excel table allows you to […]
I have built a sheet to track time at work. It is very simple, there are 13 sheets, one for […]
Functions in this article
Functions in 'Date and Time' category
The MONTH function function is one of many 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