How to Extract the Month, Year or Day from a Date in Excel

If the date is in A2, MONTH returns the month as a number from 1 to 12. YEAR and DAY return the year and the day the same way.

Formula to use

=MONTH(A2)

5 if A2 is 2026-05-04

Year and day work the same way

All three functions take one date and return one number. Because the result is a number, you can use it directly in comparisons and other calculations.

  • =YEAR(A2)2026
  • =DAY(A2)4

Show it as "2026-05" or "May"

To show the year and month together in a report, use TEXT to turn the date into formatted text. TEXT also pads a one-digit month to two digits, like 05.

  • =TEXT(A2, "yyyy-mm")2026-05
  • =TEXT(A2, "mmmm")May
  • =TEXT(A2, "mm")05

Find the quarter

Divide the month by 3 and round up to get the quarter number from 1 to 4.

  • =ROUNDUP(MONTH(A2)/3, 0)2 (second quarter) for May

Total by month

To add up May sales only, use SUMIFS on rows whose date is on or after May 1 and before June 1. Even if the data spans several years, only that month of that year is added.

  • =SUMIFS(B2:B100, A2:A100, ">="&DATE(2026,5,1), A2:A100, "<"&DATE(2026,6,1))Total for May 2026

Common mistakes

If the date is stored as text (it sits on the left of the cell), MONTH can return #VALUE! or read it differently depending on the computer settings. Convert it with DATEVALUE first.

If the result cell is formatted as a date, 5 shows up as 1900-01-05. Change the result cell format to General.

Try the functions used here

Change the arguments in the function playground and watch the calculation step by step.

  • MONTH functionReturns the month (1–12) of a date as a number.
  • YEAR functionReturns the year (1900–9999) of a date as a number.
  • DAY functionReturns the day (1–31) of a date as a number.
  • TEXT functionConverts a number or date into text with the format you choose.
  • ROUNDUP functionRounds a number up (away from zero) to a given number of digits.
  • SUMIFS functionAdds only the values in rows that meet all of several conditions.

FAQ

Can I get the weekday too?
Use =WEEKDAY(A2) for the weekday number, or =TEXT(A2, "ddd") for its name.
Can I filter with MONTH(A2)=5?
Only if the data covers a single year. If several years are mixed, May of other years is caught too, so add a YEAR condition or use the SUMIFS approach above.

More guides