← All how-to recipes

How to identify weekends with a formula

✓ Verified in LibreOffice 25.8.7.3

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

The formula

AppFormulaNotes
Excel=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. Every formula here is confirmed by actually executing it.