YEAR, MONTH and DAY in Excel: Split a Date Into Parts
By ExcelReady TeamUpdated 6 min read
The short answer
The YEAR, MONTH and DAY functions in Excel each take one date and return one part of it as a number. For 15 March 2024 in A2, =YEAR(A2) returns 2024, =MONTH(A2) returns 3 and =DAY(A2) returns 15. Put the parts back together, or change them, with DATE: =DATE(YEAR(A2),MONTH(A2),1) gives the first day of that month.
Key takeaways
- =YEAR(A2), =MONTH(A2) and =DAY(A2) each return one part of a date as a number.
- DATE(year, month, day) puts the parts back together, and handles months above 12 by rolling into the next year.
- =DATE(YEAR(A2),MONTH(A2),1) returns the first day of the month.
- A blank cell gives YEAR 1900, MONTH 1 and DAY 0, so guard formulas against empty rows.
- If a result looks like a date such as 16/07/1905, change the cell format to General.
On this page+
The YEAR, MONTH and DAY functions in Excel split a date into its three parts, each as a plain number. For 15 March 2024, YEAR returns 2024, MONTH returns 3 and DAY returns 15. This guide shows how to use them, how to put a date back together with DATE, and how to fix the odd results that come from blank cells and wrong formats.
What do the YEAR, MONTH and DAY functions do?#
Each function takes one date and returns one part of it. They all have the same simple shape, with a single argument:
| Function | Returns | Range | Example for 15 March 2024 |
|---|---|---|---|
=YEAR(A2) | The year | 1900 to 9999 | 2024 |
=MONTH(A2) | The month number | 1 to 12 | 3 |
=DAY(A2) | The day of the month | 1 to 31 | 15 |
The argument is called the serial number, because Excel stores every date as a number that counts days from 1 January 1900. You can point at a cell, use another function like TODAY(), or build a date with DATE. All three functions work in every version of Excel, on Windows and Mac.
For a wider tour of the date toolkit, see the overview of Excel date functions.
How to split a date into year, month and day#
Put each function in its own column and point it at the date. Here is a small orders table:
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Order | Date | Year | Month | Day |
| 2 | 1001 | 15/03/2024 | 2024 | 3 | 15 |
| 3 | 1002 | 02/11/2023 | 2023 | 11 | 2 |
| 4 | 1003 | 28/02/2024 | 2024 | 2 | 28 |
| 5 | 1004 | 09/07/2025 | 2025 | 7 | 9 |
The formulas in row 2 are =YEAR(B2), =MONTH(B2) and =DAY(B2). Fill them down (Windows: Ctrl+D; Mac: ⌘D).
Splitting dates like this is useful for filtering and grouping. A Year column lets you filter one year in a single click, and a Month column lets you count orders per month with COUNTIF. For counting without helper columns, see how to count dates by month.
How to put a date back together with DATE#
DATE does the opposite job: it takes a year, a month and a day and returns a real date. The syntax is =DATE(year, month, day), always in that order.
Combine DATE with YEAR, MONTH and DAY to change one part of a date and keep the others:
| Goal | Formula | Result for 15/03/2024 |
|---|---|---|
| First day of the month | =DATE(YEAR(B2),MONTH(B2),1) | 01/03/2024 |
| Same date next year | =DATE(YEAR(B2)+1,MONTH(B2),DAY(B2)) | 15/03/2025 |
| 1 January of that year | =DATE(YEAR(B2),1,1) | 01/01/2024 |
| Same day 3 months later | =DATE(YEAR(B2),MONTH(B2)+3,DAY(B2)) | 15/06/2024 |
DATE handles overflow for you. A month of 13 becomes January of the next year, and a day of 0 becomes the last day of the previous month. So =DATE(2024,3,0) returns 29 February 2024. There's more on this in getting the first and last day of a month.
DATE is also the fix when your data arrives in three separate columns. If A2 holds 2024, B2 holds 3 and C2 holds 15, =DATE(A2,B2,C2) gives a proper date. If day and month have been read the wrong way round, the guide to fixing swapped days and months uses the same functions.
How to use YEAR and MONTH in other formulas#
Use YEAR and MONTH inside IF, SUMPRODUCT or criteria to work with whole years or months. Some practical examples, using the orders table above with amounts in C2:C5 of 250, 120, 400 and 90:
Label each order with its year and quarter:
=YEAR(B2)&"-Q"&ROUNDUP(MONTH(B2)/3,0)For 15/03/2024 this returns 2024-Q1: MONTH gives 3, and 3 divided by 3, rounded up, is quarter 1.
Sum the amounts for 2024 only:
=SUMPRODUCT((YEAR(B2:B5)=2024)*C2:C5)YEAR checks each date, the comparison gives TRUE or FALSE, and multiplying by the amounts keeps only the 2024 rows. The result is 250 + 400 = 650.
Count the days in a month:
=DAY(EOMONTH(B2,0))EOMONTH(B2,0) returns the last day of B2's month. DAY then reads its day number: 29 for February 2024, because 2024 is a leap year.
If your year starts in a month other than January, plain YEAR isn't enough. The guide to getting the fiscal year from a date shows how to shift it.
Why does YEAR, MONTH or DAY give a strange result?#
Strange results usually mean the input isn't a real date or the output has the wrong format. Here are the common cases:
| What you see | Cause | Fix |
|---|---|---|
| #VALUE! | The date is text Excel can't read | Convert it to a real date first |
| 1900 from YEAR | The cell is blank | =IF(B2="","",YEAR(B2)) |
| 0 from DAY | The cell is blank | Same IF guard |
| 16/07/1905 instead of 2024 | The result cell has a date format | Format the cell as General |
| Wrong month | Day and month swapped on import | Rebuild the date with DATE |
The blank-cell case is easy to miss. A blank counts as 0, which Excel reads as a date in January 1900. So MONTH of a blank cell returns 1, and a "count by month" formula can quietly add empty rows to January.
To check whether a cell holds a real date, change its format to General. A real date turns into a number like 45366. Text stays as it was.
YEAR, MONTH and DAY vs TEXT#
Use YEAR, MONTH and DAY when you need numbers, and TEXT when you need labels. MONTH returns 3, which you can compare, add to and use in criteria. TEXT(B2,"mmmm") returns the word March, which is text and can't be used in maths.
A good habit: keep the real date in one column, calculate with YEAR, MONTH and DAY, and only turn things into text in the final report column.
Practise it#
Splitting and rebuilding dates is the foundation of almost every date task in a spreadsheet job test. Practise date basics in a live spreadsheet: you'll use DATE, YEAR, MONTH and DAY on real data, and each formula is checked instantly. Or try the exercise on this page first.
Try it yourself
This is a live spreadsheet. Type the formula in the green cell and press Enter.
How many days are in the month of each date? Click C2 and find the last day of the month with EOMONTH, then take its day number with DAY.
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Days in month | |||
| 2 | ||||
| 3 | ||||
| 4 | ||||
| 5 | ||||
| 6 | ||||
| 7 | ||||
| 8 |
Tip: EOMONTH(B2,0) gives the last day of B2's month. DAY then returns its day number.
Practise this in a lesson
Frequently asked questions
How do I extract the year from a date in Excel?
Use =YEAR(A2). It returns the year as a four-digit number, such as 2024. The cell must hold a real date, not text that looks like a date.
Why does YEAR return 1900?
The cell is empty or holds a small number. Excel treats a blank as day 0 of its calendar, which is in 1900. Check that the cell really holds a date, or wrap the formula in IF(A2="","",YEAR(A2)).
Why does MONTH show a date instead of a number?
The result cell has a date format. MONTH returned a number like 3, but the format displays it as a date in January 1900. Change the cell format to General or Number.
How do I combine year, month and day columns into a date?
Use DATE with the three cells in order: =DATE(A2,B2,C2), where A2 is the year, B2 the month and C2 the day. The result is a real date you can format and calculate with.
What is the difference between MONTH and TEXT for months?
MONTH returns a number from 1 to 12 that you can use in maths and criteria. TEXT(A2,"mmmm") returns the month name as text, which is better for labels.