Sub topic 5
Weekdays and week numbers
Sheets stores a date as a day count, so it can work out which day of the week a date falls on and which week of the year it belongs to. This chapter covers WEEKDAY, WEEKNUM and ISOWEEKNUM. It also covers the choices that make them return different answers for the same date. It assumes you can build and extract dates as in the earlier chapters. Every example uses real date values, not text that looks like a date.
What WEEKDAY returns
WEEKDAY takes a date and returns a whole number that says which day of the week it is. The number depends on the optional second argument, the type.
=WEEKDAY(date, [type])If you leave out the type, Sheets uses type 1. Type 1 counts from Sunday, so Sunday is 1 and Saturday is 7. This default surprises many people, because most calendars outside the US start the week on Monday.
| Type | First day (value) | Last day (value) |
|---|---|---|
| 1 (default) | Sunday = 1 | Saturday = 7 |
| 2 | Monday = 1 | Sunday = 7 |
| 3 | Monday = 0 | Sunday = 6 |
| 11 | Monday = 1 | Sunday = 7 |
| 12 | Tuesday = 1 | Monday = 7 |
| 13 | Wednesday = 1 | Tuesday = 7 |
| 14 | Thursday = 1 | Wednesday = 7 |
| 15 | Friday = 1 | Thursday = 7 |
| 16 | Saturday = 1 | Friday = 7 |
| 17 | Sunday = 1 | Saturday = 7 |
Types 11 to 17 name the day that counts as 1 and number the rest in order from there. Types 2 and 11 give the same result, and so do types 1 and 17. Type 3 is the only type that starts at 0.
The date 2026-11-28 is a Saturday, so with A2 holding that date:
=WEEKDAY(A2)
=WEEKDAY(A2, 2)
=WEEKDAY(A2, 3)These return 7, 6 and 5. Pick one type for a whole workbook and stick with it, because the number alone does not say which convention produced it.
Common weekday patterns
Testing for a weekend
With type 2, Saturday is 6 and Sunday is 7, so a weekend test is a simple comparison.
=WEEKDAY(A2, 2) > 5The formula returns TRUE or FALSE. You can use it in conditional formatting, in IF, or inside FILTER.
Getting the day name
You have two options for turning the number into a name. TEXT is shorter, but it returns text in the spreadsheet's locale.
=TEXT(A2, "dddd")CHOOSE takes the number and picks a label by position, so you control the wording and it never changes with locale.
=CHOOSE(WEEKDAY(A2, 2), "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun")Finding the Monday of a week
Type 3 numbers Monday as 0, so it equals the number of days since Monday. Subtracting it from the date gives that week's Monday.
=A2 - WEEKDAY(A2, 3)For 2026-11-28 this returns 2026-11-23. Add 6 to get the Sunday that ends the week. Format the result as a date, or you will see a serial number.
=A2 - WEEKDAY(A2, 3) + 6This week-start date works well as a grouping key. If every row has the Monday of its week in column C, you can total a value by week with SUMIF:
=SUMIF(C:C, E2, B:B)Here E2 holds one Monday date and B:B holds the amounts. Grouping by the date avoids the problems with week numbers described later, because a Monday date is unique across years.
Finding the next Monday
To find the first Monday after a date, add 8 and subtract the type 2 weekday.
=A2 + 8 - WEEKDAY(A2, 2)From Saturday 2026-11-28 this gives 2026-11-30. If A2 is already a Monday, it returns the Monday one week later, not the same day.
Week numbers with WEEKNUM
WEEKNUM returns the week of the year, from 1 to 54.
=WEEKNUM(date, [type])The type here chooses the first day of the week. The default type 1 treats Sunday as the first day, and type 2 uses Monday. Types 11 to 17 let you start on any day, with the same meaning as in WEEKDAY. Type 21 uses the ISO rule, which is described in the next section.
The important rule for every type except 21 is that week 1 is the week that contains January 1. That week can be only one day long. In 2027, January 1 falls on a Friday. With the default type, that Friday and the following Saturday are week 1, and Sunday January 3 starts week 2.
=WEEKNUM(DATE(2027, 1, 1))
=WEEKNUM(DATE(2027, 1, 3))These return 1 and 2. Because of this rule, a year can have 54 numbered weeks, and the first and last weeks are often partial.
ISO week numbers with ISOWEEKNUM
ISO 8601 is the standard that many European countries and international companies use for week numbering. Its rules are different:
- Weeks start on Monday.
- Week 1 is the week that contains the first Thursday of the year. Equivalently, it is the week that contains January 4.
- Every week has seven days, and a year has 52 or 53 weeks.
=ISOWEEKNUM(date)ISOWEEKNUM(A2) matches WEEKNUM(A2, 21). The two give the same result, so use whichever reads more clearly.
For 2026-11-28, WEEKNUM, WEEKNUM with type 2, and ISOWEEKNUM all return 48. They agree on most dates in the middle of a year. They differ near the year boundary:
| Date | Weekday | WEEKNUM (type 1) | ISOWEEKNUM |
|---|---|---|---|
| 2026-11-28 | Saturday | 48 | 48 |
| 2027-01-01 | Friday | 1 | 53 |
| 2027-01-03 | Sunday | 2 | 53 |
| 2027-01-04 | Monday | 2 | 1 |
2026 begins on a Thursday, so it has 53 ISO weeks. The days from Friday 2027-01-01 to Sunday 2027-01-03 still belong to week 53 of 2026. ISO week 1 of 2027 starts on Monday 2027-01-04.
The ISO year can differ from the calendar year
Because early January can belong to the last ISO week of the previous year, a week number alone is ambiguous. Week 53 of what year? If you build labels or group by ISO week, compute the ISO year too. The Thursday of a date's week always lies in the ISO year, so take the year of that Thursday:
=YEAR(A2 - WEEKDAY(A2, 2) + 4)For 2027-01-01 the formula finds Thursday 2026-12-31 and returns 2026. A complete label combines both parts:
=YEAR(A2 - WEEKDAY(A2, 2) + 4) & "-W" & TEXT(ISOWEEKNUM(A2), "00")For 2027-01-01 this returns 2026-W53. The "00" pattern pads single digits, so week 5 becomes 05 and labels sort correctly as text.
Choosing a function
Pitfalls
- Blank cells are day zero. A blank cell counts as 0, which is 1899-12-30, a Saturday.
WEEKDAYof a blank cell returns 7 with the default type, not an error. Guard against blanks withIF(A2="", "", WEEKDAY(A2, 2)). - Text is not a date.
WEEKDAYon a text string such as"28/11/2026"can return an error or a wrong day, depending on how the locale parses it. Convert text withDATEVALUEfirst, as covered in the chapter on text conversion. - Date-times work, but the time is ignored.
WEEKDAYand the week functions use the whole-day part of a date-time and drop the fraction. - Types are not interchangeable. If one sheet uses
WEEKNUM(A2)and another usesISOWEEKNUM(A2), their totals can disagree for the first and last days of the year, with no formula error to warn you. - Out-of-range types fail. A type such as 4 returns an error instead of falling back to the default. Check the table above before choosing.
Exercises
Exercise
Cell A2 holds the date 2026-11-28. Write a formula that returns TRUE when the date is a Monday, Tuesday, Wednesday, Thursday or Friday, and FALSE on a weekend. What does it return for A2?
Show answer
=WEEKDAY(A2, 2) <= 5. With type 2, Monday to Friday are 1 to 5 and Saturday and Sunday are 6 and 7. The date 2026-11-28 is a Saturday, so WEEKDAY(A2, 2) is 6 and the formula returns FALSE.
Exercise
Cell A2 holds 2027-01-01. What do =WEEKNUM(A2) and =ISOWEEKNUM(A2) return, and why do they differ?
Show answer
WEEKNUM returns 1 and ISOWEEKNUM returns 53. WEEKNUM with the default type makes the week containing January 1 week 1. ISOWEEKNUM follows ISO 8601, where week 1 contains the first Thursday of the year. 2027-01-01 is a Friday, so it still belongs to the last ISO week (week 53) of 2026, and week 1 of 2027 starts on Monday 2027-01-04.
Exercise
Write one formula that returns the Monday of the week containing the date in A2, then one that returns the Sunday of that same week.
Show answer
Monday: =A2 - WEEKDAY(A2, 3). Sunday: =A2 - WEEKDAY(A2, 3) + 6. Type 3 numbers Monday as 0 and Sunday as 6, so subtracting it moves back to Monday. For A2 = 2026-11-28 the results are 2026-11-23 and 2026-11-29. Format both cells as dates.