Conditional formatting based on the day of the week

Solved
Gael -  
 Gael -
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. jee pee Posted messages 9444 Registration date   Status Moderator Last intervention   9 981
     
    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)

    0
  2. Gael
     
    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...
    0
    1. eriiic Posted messages 24581 Registration date   Status Contributor Last intervention   7 281
       
      You should do some research on relative and absolute references.
      It's part of the basics you need to know.
      eric
      0
  3. yclik Posted messages 3875 Registration date   Status Member Last intervention   1 611
     
    Hello
    in the WEEKDAY function, you need to determine type 2 for Monday = 1
    =WEEKDAY(A2;2)
    So
    0
  4. Gael
     
    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.
    0