Skip to content

Take a date apart with YEAR, MONTH, DAY and WEEKDAY

Dates and times6 min

Builds on Add and subtract days with dates and Decide with IF.

The sales manager wants order totals by month and by quarter, and facilities pays a supplement for weekend deliveries. Both answers are already inside the order dates.

How it works

YEAR, MONTH and DAY each read one part of a date and return it as a plain number. For Nov 29, 2026, YEAR gives 2026, MONTH gives 11 and DAY gives 29. Picture the date as a stamp with three fields printed on it, where each function reads one field. The results are ordinary numbers, so they work in IF tests and in SUMIF.

WEEKDAY returns the day of the week as a number. Its optional second argument, the return type, decides how the days are numbered, and the default catches people out: Sunday is 1 and Saturday is 7, so the weekend sits at both ends of the week.

RowABCDE
1Return typeMondayFridaySaturdaySunday
21, or left out2671
321567
430456

With return type 2, Saturday and Sunday are the only days above 5.

Example

Reports often need a key that sorts by year and then by month. For Dec 12, 2026 in F2:

=YEAR(F2)*100+MONTH(F2)
Multiplies the year of the date in F2 by 100 and adds its month.

It returns 202612, which sorts after 202611 and before 202701.

Common mistakes

  • =WEEKDAY(F2)>5 uses the default numbering, where Friday is 6 and Sunday is 1, so it flags Fridays and Saturdays. Give the return type.
  • =YEAR(F2) can show Jul 18, 1905 when Excel gives the new cell a date format: the cell holds 2026, read as a date. Format the cell as General.
  • MONTH returns 12 for every December. When the data covers more than one year, group by year and month together.

In short

  • YEAR, MONTH and DAY return plain numbers to test and group by.
  • WEEKDAY numbers the days according to its return type. With 2, Monday is 1 and Sunday is 7.
  • Format the results as numbers, not dates.

Practice

4 exercises · free with an account

Start practicing
  1. Not started

    1. The month of each order

    Formula · easy

  2. Not started

    2. Weekend deliveries

    Formula · medium

  3. Not started

    3. The payroll cut-off day

    Formula · medium

  4. Not started

    4. Quarter labels for the report

    Formula · hard