Home  /  Blog  /  Date & Text
Date & Text

Month and Year From a Date in Excel — With Examples (TEXT, MONTH, YEAR, EOMONTH)

By admin 30 November 2026 Date & Text

You have a column of order dates and you need a column that says “Sep 2026” — or the month number, or the quarter. The answer depends on what you want the result for: for a label, use =TEXT(D2,"mmm yyyy"), which turns 3 Sep 2026 into “Sep 2026”; for grouping, sorting and totalling, use =EOMONTH(D2,-1)+1, which returns 1 Sep 2026 as a real date; and for the two parts as numbers, use =MONTH(D2) and =YEAR(D2). This guide runs all of them on the same ten-order table, so you can check every answer yourself — the name, the number, the label, the grouping date, the first and last day, the days in the month, the quarter, the 4th Wednesday and the week number — plus the trap that mixes two years together.

Quick takeaway: TEXT gives you the name; MONTH and YEAR give you the numbers.

  • =TEXT(D2,"mmm yyyy") → “Sep 2026”. A label — text, not a date.
  • =MONTH(D2) → 9, =YEAR(D2) → 2026. Numbers you can filter and calculate with.
  • =EOMONTH(D2,-1)+1 → 1 Sep 2026. A real date — the one to group, sort and total by.
  • =YEAR(D2)*100+MONTH(D2) → 202609. One sortable number for month and year together.
  • MONTH alone mixes years — always carry the year with it.
Month and Year From a Date in Excel — With Examples (TEXT, MONTH, YEAR, EOMONTH)

The Worked Table — Ten Order Dates

Every example below uses the same ten orders. Every result was checked against them.

Excel rowA RepB RegionC SalesD Order Date
2AlexEast12009/3/2026
3PriyaWest8509/15/2026
4Jordaneast240010/2/2026
5SamNorth45010/9/2026
6AlexWest175010/20/2026
7TaylorEast60010/22/2026
8PriyaEast90011/4/2026
9JordanSouth110011/12/2026
10SamWest30011/20/2026
11AlexNorth150012/1/2026

The Month and the Year as Numbers — MONTH, YEAR, DAY

The most direct way to separate a date is by using three dedicated, easy-to-remember functions. DAY returns the day of the month as a number from 1 to 31, MONTH returns the month as a number from 1 (January) to 12 (December), and YEAR extracts the four-digit year.

Excel rowD Order Date=DAY(D2)=MONTH(D2)=YEAR(D2)
29/3/2026392026
39/15/20261592026
410/2/20262102026
510/9/20269102026
610/20/202620102026
710/22/202622102026
811/4/20264112026
911/12/202612112026
1011/20/202620112026
1112/1/20261122026

For filters, comparisons and maths you want numbers, not text. =MONTH(D2) returns 9 and =YEAR(D2) returns 2026, and the time of day is ignored if the cell holds one. Both need a real date in the cell: if the date was imported as text, MONTH and YEAR still work when Excel can read the text as a date in your regional settings, and return #VALUE! when it cannot.

The Month Name — TEXT

Maybe you prefer to see the name of the month or an abbreviation rather than the number. You can do this for the month using the TEXT function. The syntax is TEXT(value, format_code), where the value is the cell containing the date and the format_code is how you want to display the result.

Format codeWhat it gives=TEXT(D2,”…”) on 9/3/2026
mMonth, one or two digits9
mmMonth, two digits09
mmmMonth, three lettersSep
mmmmMonth, full nameSeptember
yyYear, two digits26
yyyyYear, four digits2026

You need at least four M’s within quotation marks to get the full month name. The number of letters in the month’s name does not correspond to the number of M’s in the argument; just enter at least four of them. To get the three-letter abbreviation instead of the full name, just use three M’s.

Excel rowD Order Date=TEXT(D2,”mmmm”)=TEXT(D2,”mmm”)=TEXT(D2,”mmm yyyy”)=TEXT(D2,”m/yy”)
29/3/2026SeptemberSepSep 20269/26
39/15/2026SeptemberSepSep 20269/26
410/2/2026OctoberOctOct 202610/26
510/9/2026OctoberOctOct 202610/26
610/20/2026OctoberOctOct 202610/26
710/22/2026OctoberOctOct 202610/26
811/4/2026NovemberNovNov 202611/26
911/12/2026NovemberNovNov 202611/26
1011/20/2026NovemberNovNov 202611/26
1112/1/2026DecemberDecDec 202612/26

Two things to know. The result is text, so it lines up on the left and cannot be used in date maths — =TEXT(D2,"mmm yyyy")+1 errors, and a SUMIFS on the text column finds nothing. And TEXT format codes follow the language of your Excel: in a German version the year code is JJJJ, not yyyy, so a shared formula can show the wrong thing on another person’s computer. The same TEXT function is covered in full, with the currency and percentage codes, on the TEXT function page.

The Month and Year Together — One Label, One Number, One Date

There are three ways to put the month and year together, and they are not interchangeable:

What you wantFormulaResult on 9/3/2026What it is
A label to read=TEXT(D2,"mmm yyyy")Sep 2026Text — good for a heading, useless for maths
One sortable number=YEAR(D2)*100+MONTH(D2)202609A number — sorts and compares correctly
A real date to group by=EOMONTH(D2,-1)+11 Sep 2026A date — sorts in date order, works in SUMIFS and PivotTables

The number version is the one to use in a lookup table: 202609 for September, 202610 for October, 202611 for November, 202612 for December — the year times 100 plus the month, so the months sort in order and two years never collide. The date version is the one to use in a PivotTable: format the cell as mmm yyyy and it shows “Sep 2026” while staying a real date underneath. You can also combine the two numbers with an ampersand, =MONTH(D2)&"/"&YEAR(D2), which gives “9/2026” — but that is text again, so it does not sort as a date.

The Trap — MONTH Alone Mixes Years

MONTH alone is a trap once your data spans more than a year. =SUMPRODUCT((MONTH(D2:D11)=9)*C2:C11) returns 2050 on this table — September’s 1200 + 850 — and that is right here, because every order is from 2026. But add one September 2025 order of 400 and the same formula returns 2450, because it adds September 2025 to September 2026 without telling you. The fix is to carry the year with the month:

=SUMPRODUCT((YEAR(D2:D11)=2026)*(MONTH(D2:D11)=9)*C2:C11)

That returns 2050 — September 2026 only. Or group by the month-year number instead: =SUMPRODUCT((YEAR(D2:D11)*100+MONTH(D2:D11)=202609)*C2:C11) also returns 2050. The monthly totals on this table, by the grouping date, are September 2050, October 5200, November 2300 and December 1500 — and the total is 11050, which matches the sum of all ten orders.

First Day, Last Day, and Days in the Month

If you need to calculate the first or last day of a month, the EOMONTH (end of month) function works well:

Excel rowD Order DateFirst day =EOMONTH(D2,-1)+1Last day =EOMONTH(D2,0)Days in month =DAY(EOMONTH(D2,0))
29/3/20269/1/20269/30/202630
39/15/20269/1/20269/30/202630
410/2/202610/1/202610/31/202631
510/9/202610/1/202610/31/202631
610/20/202610/1/202610/31/202631
710/22/202610/1/202610/31/202631
811/4/202611/1/202611/30/202630
911/12/202611/1/202611/30/202630
1011/20/202611/1/202611/30/202630
1112/1/202612/1/202612/31/202631

The last day of the previous month is =EOMONTH(D2,-1), the first day of the selected month is =EOMONTH(D2,-1)+1, and the last day of the selected month, last year, is =EOMONTH(D2,-12). Once you have two such dates, the days between dates guide counts the gap between them. The days-in-month formula is the last day’s day number: September has 30, October 31, November 30, December 31. February is the one to watch — 2026 is not a leap year, so February 2026 has 28 days, and February 2024 had 29.

The Quarter — Number, Label, and Quarter End

The quarter is the month number, divided into threes:

Excel rowD Order DateQuarter =INT((MONTH(D2)-1)/3)+1Label =”Q”&INT((MONTH(D2)-1)/3)+1&” “&YEAR(D2)Quarter end
29/3/20263Q3 20269/30/2026
39/15/20263Q3 20269/30/2026
410/2/20264Q4 202612/31/2026
510/9/20264Q4 202612/31/2026
610/20/20264Q4 202612/31/2026
710/22/20264Q4 202612/31/2026
811/4/20264Q4 202612/31/2026
911/12/20264Q4 202612/31/2026
1011/20/20264Q4 202612/31/2026
1112/1/20264Q4 202612/31/2026

The quarter number is =INT((MONTH(D2)-1)/3)+1 — months 1–3 give 1, 4–6 give 2, 7–9 give 3, 10–12 give 4. The quarter end is the last day of the quarter’s third month: =EOMONTH(DATE(YEAR(D2),INT((MONTH(D2)-1)/3)*3+3,1),0) — 30 September for Q3, 31 December for Q4. The quarter totals on this table are Q3 2050 and Q4 9000, which add to 11050.

The 4th Wednesday of the Month

The “4th Wednesday” keyword is a date built from the month, not a lookup:

=DATE(YEAR(D2),MONTH(D2),1)+CHOOSE(WEEKDAY(DATE(YEAR(D2),MONTH(D2),1)),3,2,1,0,6,5,4)+21

That returns the 4th Wednesday of the order’s month:

Month4th Wednesday
September 202623 Sep 2026
October 202628 Oct 2026
November 202625 Nov 2026
December 202623 Dec 2026

Read it from the inside out: DATE(YEAR(D2),MONTH(D2),1) is the 1st of the month; WEEKDAY of the 1st tells you which day of the week it is; the CHOOSE gives the days to the first Wednesday — 3 if the 1st is a Sunday, 2 if Monday, 1 if Tuesday, 0 if Wednesday, 6 if Thursday, 5 if Friday, 4 if Saturday; and +21 moves three weeks on, from the 1st Wednesday to the 4th. September’s Wednesdays are 2, 9, 16, 23 and 30, so the 4th is the 23rd. Change the CHOOSE to target another weekday, or change +21 to +7, +14 or +28 for the 2nd, 3rd or 5th.

The Week of the Year

Excel rowD Order DateWeekday=WEEKNUM(D2)=ISOWEEKNUM(D2)
29/3/2026Thursday3636
39/15/2026Tuesday3838
410/2/2026Friday4040
510/9/2026Friday4141
610/20/2026Tuesday4343
710/22/2026Thursday4343
811/4/2026Wednesday4545
911/12/2026Thursday4646
1011/20/2026Friday4747
1112/1/2026Tuesday4949

WEEKNUM and ISOWEEKNUM agree on all ten dates here — and they usually do in the middle of the year. They differ at the edges: 29 December 2025 is WEEKNUM 53 but ISOWEEKNUM 1, because the ISO week belongs to 2026. Use ISOWEEKNUM when the week must follow the ISO rule (weeks start Monday, week 1 is the week with the first Thursday), and WEEKNUM when the week starts on Sunday and week 1 is the week containing 1 January. The weekday itself comes from the day of week formula guide.

Common Mistakes

MistakeWhat happensFix
You used TEXT and then tried to calculate with itTEXT gives text — =TEXT(D2,"mmm yyyy")+1 errors, and SUMIFS on the text column finds nothingUse EOMONTH for grouping, or MONTH/YEAR for maths
You grouped by MONTH aloneSeptember 2025 and September 2026 add togetherCarry the year: YEAR*100+MONTH, or the EOMONTH grouping date
You used “mm” for the full month name“mm” gives 09, not SeptemberUse “mmmm” — at least four M’s
You used “yy” and got 26“yy” is the two-digit year — 26, not 2026Use “yyyy” for the four-digit year
You typed the month as textMONTH(“September”) errors — it needs a real datePut a real date in the cell and read MONTH from it
You used WEEKNUM at the year edge29 Dec 2025 is WEEKNUM 53 but ISOWEEKNUM 1Pick the week system first, then the function

Frequently Asked Questions

How do I get the month name from a date in Excel? =TEXT(D2,"mmmm") for the full name — September — or =TEXT(D2,"mmm") for the abbreviation — Sep.

How do I get the month and year together? For a label, =TEXT(D2,"mmm yyyy") gives “Sep 2026”. For a sortable number, =YEAR(D2)*100+MONTH(D2) gives 202609. For a real date to group by, =EOMONTH(D2,-1)+1 gives 1 Sep 2026.

How do I get the month number from a date? =MONTH(D2) — 9 for September, 10 for October, 11 for November, 12 for December. =YEAR(D2) gives 2026.

How do I get the first day of the month? =EOMONTH(D2,-1)+1 — 1 Sep 2026 for any September date. The last day is =EOMONTH(D2,0) — 30 Sep 2026.

How many days are in the month? =DAY(EOMONTH(D2,0)) — 30 for September and November, 31 for October and December.

What quarter is this date in? =INT((MONTH(D2)-1)/3)+1 — 3 for September, 4 for October, November and December. The label is ="Q"&INT((MONTH(D2)-1)/3)+1&" "&YEAR(D2).

How do I get the 4th Wednesday of the month? =DATE(YEAR(D2),MONTH(D2),1)+CHOOSE(WEEKDAY(DATE(YEAR(D2),MONTH(D2),1)),3,2,1,0,6,5,4)+21 — 23 Sep 2026 for September, 28 Oct 2026 for October.

That is the month and the year from a date in Excel: =TEXT(D2,"mmm yyyy") for the label, =MONTH(D2) and =YEAR(D2) for the numbers, and =EOMONTH(D2,-1)+1 for the real date to group by — and on the ten-order table in this guide they answer every question: September is 2050 in sales, October is 5200, November is 2300 and December is 1500; the quarters are Q3 2050 and Q4 9000; the first days are 1 Sep, 1 Oct, 1 Nov and 1 Dec; the last days are 30 Sep, 31 Oct, 30 Nov and 31 Dec; and the 4th Wednesdays are 23 Sep, 28 Oct, 25 Nov and 23 Dec. Remember the two things that catch everyone once: TEXT gives you text, so it cannot be calculated with — use the EOMONTH date for grouping and the MONTH and YEAR numbers for maths — and MONTH alone mixes years, so always carry the year with it, as 202609 or as the 1st of the month. From here, the next functions worth learning are the ones these sit next to — the TEXT function itself, for the full format codes, and the day of week formula for the weekday side of the same dates — and the full learning order for the whole site is on the Excel Formulas hub and the Date & Text topic page.


About admin

Author of Excel formula guides on this blog.

View all guides by admin →

Keep Learning

Related guides