← All how-to recipes

How to identify weekends with a formula

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

Flag Saturday/Sunday rows — for conditional formatting, filtering, or excluding from stats.

The formula

AppFormulaNotes
Excel (desktop)=WEEKDAY(A2,2)>5Mode 2 numbers Monday=1..Sunday=7, so >5 means Sat/Sun. Use inside conditional formatting too.
Google Sheets=WEEKDAY(A2,2)>5Identical.
LibreOffice Calc=WEEKDAY(A2,2)>5Identical.

How it works

WEEKDAY with mode 2 counts Monday as 1 through Sunday as 7, so any value above 5 is a weekend — July 25, 2026 is a Saturday, hence TRUE. The same expression pasted into a conditional-formatting rule shades weekend rows, and =IF(WEEKDAY(A2,2)>5,"Weekend","Weekday") labels them. Mode 2 is the trick worth remembering: the default mode numbers Sunday as 1, which makes the weekend test the clumsier OR(WEEKDAY(A2)=1,WEEKDAY(A2)=7).

Verified, not just documented

We ran =WEEKDAY(DATE(2026,7,25),2)>5 in LibreOffice 25.8.7.3 (headless, with forced recalculation) and it returned True — 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 True 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

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

Related recipes