Sub topic 5
Weekdays and week numbers
This chapter assumes that you can enter formulas, use relative and absolute cell references, and apply number formats from the Format menu. The examples use dates in column A, beginning with A2.
Returning the weekday number
WEEKDAY is a function that converts a date into a number representing its day of the week.
=WEEKDAY(A2, 2)The second argument, 2, selects the Monday-based numbering system. Monday is 1 and Sunday is 7.
| Formula | Weekday numbering |
|---|---|
| `=WEEKDAY(A2)` | Sunday = 1 through Saturday = 7 |
| `=WEEKDAY(A2, 2)` | Monday = 1 through Sunday = 7 |
| `=WEEKDAY(A2, 3)` | Monday = 0 through Sunday = 6 |
The second form is often easiest for work schedules because weekdays occupy 1 through 5. For example, this formula tests whether the date is a weekday:
=AND(WEEKDAY(A2, 2) >= 1, WEEKDAY(A2, 2) <= 5)To display the weekday name instead of a number, format the date as text:
=TEXT(A2, "dddd")This returns a label such as Monday. The result is text, so do not use it for date arithmetic.
Finding week numbers
A week number tells you which numbered week contains a date. WEEKNUM lets you choose which day starts the week.
=WEEKNUM(A2, 2)With type 2, weeks start on Monday. With type 1, weeks start on Sunday.
=WEEKNUM(A2, 1)These systems can produce different results near the beginning and end of a year. A date in early January might still belong to the last week of the previous reporting year, depending on the chosen rule.
ISO week numbers
The ISO week system is a widely used standard. Weeks start on Monday, and ISO week 1 is the week containing the year's first Thursday. Therefore, the first few days of January can belong to ISO week 52 or 53 of the previous ISO year.
Use ISOWEEKNUM when reports or external systems require ISO weeks:
=ISOWEEKNUM(A2)If you group records by ISO week, store the ISO year as well as the week number. The ordinary calendar year from YEAR(A2) can be wrong at a year boundary. This formula returns the ISO year:
=YEAR(A2-WEEKDAY(A2, 2)+4)A useful report key combines both values:
=YEAR(A2-WEEKDAY(A2, 2)+4)&"-W"&TEXT(ISOWEEKNUM(A2), "00")For example, the key might be 2027-W01. Combining year and week prevents week 01 from different years from being mixed together.
A practical workflow
Use this sequence when adding weekly categories to a sheet:
If your source dates include times, these functions still work because the date is the whole-number part of the stored value. The time fraction does not change the weekday or week number.
Exercise
Cell A2 contains the date 2026-01-01. Which formula returns its ISO week number, and why should an ISO year be stored with it?
Show answer
Use =ISOWEEKNUM(A2). The ISO week may belong to a different calendar year near January 1, so store the ISO year too, for example with =YEAR(A2-WEEKDAY(A2, 2)+4).