Conditional formatting based on the day of the week

Solved
Hello,

I have a table with lots of dates, like project progress. I want the background of all cells containing a date that falls on a Saturday or a Sunday to have a specific style (which I have defined: light blue background).

However, my conditional formatting is not working at all.

Do you have any idea how to make this work?

Thank you for your attention.

Gaël

Configuration: Linux Mageia/ Firefox 93.0 / LibreOffice 7.2.5.2.0+

5 answers

  1. Moderator
    Hello,

    Maybe you can draw inspiration from the logic in Excel where you would write the condition:
    =OR(WEEKDAY(A1)=7,WEEKDAY(A1)=1) 

    either WEEKDAY=7 (Saturday) or 1 (Sunday)

    1. Hello,

      Thank you for your response. But since I am doing conditional formatting, I cannot specify the cell. In your example, it's only A1.

      Moreover, the conditional formatting window is not a formula, so it doesn't work.

      I have:
      "cell value" then "is equal to" then a field for a potential formula...
      1. Contributor
        You should do some research on relative and absolute references.
        It's part of the basics you need to know.
        eric
    2. Hello
      in the WEEKDAY function, you need to determine type 2 for Monday = 1
      =WEEKDAY(A2;2)
      So
      1. Hello

        Thank you very much!!

        It works!

        I selected the entire sheet and then "Conditional formatting" and there I set two conditions:
        Condition 1: Formula is: IF(WEEKDAY(A2,2)>6)
        and
        Condition 2: Formula is: IF(WEEKDAY(A2,2)<2)

        Then I chose the weekend format that I had created and it worked.

        Thank you very much for your help.