Google-sheets – Set conditional formatting on a column that depends on another cell’s text (not value)

conditional formattinggoogle sheets

I am making a shift calendar. I have it so my calendar dates are displayed with the day names and they are a formula so if I enter one date, the rest of the calendar changes to follow suit.

I want the columns to highlight yellow if the days are weekends. For example, if B1 has the text "Sat" or "Sun" I want the entire B column to turn yellow. But since the value is the numerical date and not the text "Sat" I don't know how to make the conditional formatting work. Do I need a script or is there a formula that could work?

Best Answer

Since you use the date value, we have a nice weekday() function we can make use of.

weekday(*yourDate*,2) will give you an integer from 1-7 counting from Monday. On the conditional formatting applied to your targetted range, we can then use the following custom formula to highlight weekends:

=weekday(B$1,2)>5