← All how-to recipes

How to get the week number of a date

✓ Verified in LibreOffice 25.8.7.3 ✓ Verified in Google Sheets (2026-08-30)

Find which week of the year a date falls in — for weekly reports and grouping.

The formula

AppFormulaNotes
Excel (desktop)=WEEKNUM(A2)US convention: week 1 contains Jan 1, weeks start Sunday. Use ISOWEEKNUM for the ISO standard.
Google Sheets=WEEKNUM(A2)Identical, including ISOWEEKNUM.
LibreOffice Calc=WEEKNUM(A2)Identical.

How it works

WEEKNUM's default numbering calls the week containing January 1 "week 1" and starts weeks on Sunday — July 21, 2026 lands in week 30. Businesses in Europe usually want ISO week numbers instead (weeks start Monday; week 1 is the one containing the first Thursday): that's ISOWEEKNUM(A2), which can differ by 1 from WEEKNUM near year boundaries — the classic source of off-by-one week reports.

Verified, not just documented

We ran =WEEKNUM(DATE(2026,7,21)) in LibreOffice 25.8.7.3 (headless, with forced recalculation) and it returned 30 — exactly the expected result. We then ran the same formulas in Google Sheets, executed 2026-08-30: a formula-only workbook goes into Google Drive, which converts it to a Sheet and recalculates every formula with Google’s own engine, and comes back out as .xlsx carrying the values Google computed. It returned 30 for the worked example, the same value LibreOffice produced. Both engines’ numbers on this page are executed results. The Excel formula follows Microsoft’s official documented syntax — we do not run desktop Excel.

Functions used

WEEKNUM — see full Excel, Google Sheets & LibreOffice compatibility for each.