You type =WEEKNUM(TODAY()) in Excel, get a number back, and it doesn't match the week your Python script just printed. Annoying.
Both are right. They're following different rules.
Excel's default WEEKNUM counts weeks one way. Python's isocalendar() follows ISO 8601, the standard most of Europe and most databases use. Google Sheets does either, depending on which argument you hand it.
So here's every formula you need, the one function per platform that gives a true ISO week number, and the three spots where these tools quietly disagree.
The short answer
To get the ISO 8601 week number in Excel, use =ISOWEEKNUM(A1). In Google Sheets, the same function works: =ISOWEEKNUM(A1). In Python, call date.isocalendar().week or format a date with %V.
All three return the week as ISO 8601 defines it: weeks start on Monday, and week 1 is the week holding the year's first Thursday. For July 15, 2026, every one of them returns 29.
Week numbers in Excel
Excel ships two functions for this, and they are not the same.
IC7 gives the proper ISO 8601 week. One argument, no options, always ISO. It's been in Excel since the 2013 version.
=ISOWEEKNUM(A1)
IC8 is the older, looser one. By default it breaks weeks on Sunday and calls the week containing January 1 "week 1." That's the US convention rather than ISO.
The second argument sets the week start:
| return_type | Week starts | System |
|---|---|---|
| 1 or omitted | Sunday | US (week 1 holds Jan 1) |
| 2 | Monday | US (week 1 holds Jan 1) |
| 11 to 17 | Monday through Sunday | US |
| 21 | Monday | ISO 8601 |
If you want ISO out of WEEKNUM, pass 21:
=WEEKNUM(A1, 21)
That matches ISOWEEKNUM exactly. I'd still reach for ISOWEEKNUM though. It reads clearer, and you can't fat-finger the wrong return type.

Week numbers in Google Sheets
Google Sheets copies Excel here almost exactly. Same two functions, same names.
IC12 returns the ISO week. Use this one.
IC13 takes a type argument that behaves like Excel's: 1 for a Sunday start, 2 for Monday, 21 for full ISO. Pass 21 and it lines up with ISOWEEKNUM.
One small trap. Make sure A1 holds a real date value, not text that looks like a date. If Sheets left-aligns the cell, it's text, and the formula will error or hand you nonsense. Wrap it in DATEVALUE() when you're unsure.
Week numbers in Python
Python does this with the standard library and no install.
CODE0
IC16 returns a named tuple of three values: ISO year, ISO week, ISO weekday. In Python 3.9 and later you read them as .year, .week, .weekday. On older versions, index them, so d.isocalendar()[1] is the week.
If you're building a string instead, %V gives the zero-padded ISO week:
CODE1
But watch the other two directives. %U and %W look like the same thing and they are not. %U counts weeks from the first Sunday, %W from the first Monday, and both label early-January days as week 00. Neither will match ISOWEEKNUM.

Why does WEEKNUM give a different number than Python?
Two reasons, both about where a week begins and where the year flips.
Excel's default WEEKNUM restarts every year at January 1 and breaks weeks on Sunday. ISO 8601 (Python's isocalendar and ISOWEEKNUM) starts weeks on Monday and lets the first and last days of a year belong to a neighbouring year's week.
Here are five dates run through each function:
| Date | Weekday | IC30 | IC31 | IC32 / Python |
|---|---|---|---|---|
| Jan 1, 2026 | Thu | 1 | 1 | 1 |
| Jan 4, 2026 | Sun | 2 | 1 | 1 |
| Jul 15, 2026 | Wed | 29 | 29 | 29 |
| Dec 31, 2026 | Thu | 53 | 53 | 53 |
| Jan 1, 2027 | Fri | 1 | 53 | 53 |
Look at the bottom row. On January 1, 2027, default WEEKNUM resets to 1 because the calendar year ticked over. ISO says that Friday still sits in week 53 of 2026, because the week it belongs to started on Monday December 28, 2026.
That last row is where most "my week numbers are off by a year" bugs are born.
Why January 1 isn't always in week 1
This trips people up, so here's the rule.
In ISO 8601, week 1 is the week that contains the year's first Thursday. Same thing as the week holding January 4. Any day in the year before that first Thursday belongs to the final week of the previous year.
So whether January 1 lands in week 1 depends on its weekday:
- Monday, Tuesday, Wednesday, or Thursday? It's in week 1.
- Friday, Saturday, or Sunday? It's in week 52 or 53 of the year before.
Real cases: January 1, 2022 was a Saturday, so it fell in week 52 of 2021. January 1, 2026 is a Thursday, so it sits safely in week 1.
This is also why some years run to 53 weeks. 2026 is one of them, because January 1 is a Thursday. There's more on why a year has 53 weeks if you want the full breakdown.
Getting the ISO year, not just the week
A bare week number gets ambiguous near year boundaries, so store the ISO year alongside it.
Python hands you both at once:
CODE2
The year is 2026, not 2027. That's the whole point.
Excel and Sheets have no built-in "ISO year" function. You either derive it from ISOWEEKNUM with a YEAR adjustment, or you label each row with the Monday that starts its ISO week:
=A1 - WEEKDAY(A1, 2) + 1
That returns the Monday opening the week, which is unambiguous and sorts correctly. I lean on that far more than a raw week number when grouping data by week.
FAQ
Which Excel function gives the ISO week number?
IC36 . It follows ISO 8601 with no extra arguments and has shipped since Excel 2013. WEEKNUM(date, 21) returns the same value.
Why does my Python week number differ from Excel?
Python's isocalendar() uses ISO 8601, which starts weeks on Monday. Excel's default WEEKNUM starts on Sunday and resets at January 1. Switch to ISOWEEKNUM in Excel, or WEEKNUM(date, 21), and they line up.
What's the difference between %V, %U and %W in Python?
IC42 is the ISO 8601 week (Monday start, matches isocalendar). %U counts from the first Sunday and %W from the first Monday, with early-January days numbered 00. Only %V is ISO.
Does Google Sheets have ISOWEEKNUM?
Yes. =ISOWEEKNUM(A1) works exactly as it does in Excel. WEEKNUM with a type of 21 also returns the ISO week.
Can a week number be 53?
Yes, in ISO years that begin on a Thursday, or leap years that begin on a Wednesday. 2026 has 53 weeks: week 53 runs Monday December 28, 2026 to Sunday January 3, 2027.
Quick reference
- Excel and Sheets, ISO week: IC49
- Excel and Sheets, ISO via WEEKNUM: IC50
- Python, ISO week:
date.isocalendar().weekor IC52 - Checking a single date? Use the week calculator or grab the full 2026 week calendar.
For the standard behind all of this, see the ISO 8601 week number guide.
Sources and further reading
- ISO 8601 date and time format, ISO
- ISO week date, Wikipedia
- Python datetime documentation, the official reference for
isocalendar()and IC54