Forum Discussion
conditional formatting based on 2 seperate rules
- Mar 21, 2024
See the attached workbook for alternatives.
To achieve conditional formatting based on two separate rules, one for Sun-Thu and another for Fri-Sat, you can use a combination of Excel's IF function and conditional formatting rules. Here's how you can set it up:
- Select the range of cells where you want the conditional formatting to apply (e.g., the cells containing the count of people on shift).
- Go to the "Home" tab in Excel.
- Click on "Conditional Formatting" in the toolbar.
- Choose "New Rule" from the drop-down menu.
- In the "New Formatting Rule" dialog box, select "Use a formula to determine which cells to format".
- For Sun-Thu (assuming your date is in cell A1):
Enter the following formula:
=AND(A1<>"", WEEKDAY(A1, 2)<=5, A1>6)
- Click on the "Format" button and choose the formatting style you want for when the condition is met (e.g., turn the box green).
- Click "OK" to confirm the formatting.
7. For Fri-Sat (assuming your date is in cell A1):
- Enter the following formula:
=AND(A1<>"", WEEKDAY(A1, 2)>5, A1>8)
- Click on the "Format" button and choose the formatting style you want for when the condition is met (e.g., turn the box green).
- Click "OK" to confirm the formatting.
8. Click "OK" again to apply the conditional formatting rules.
This setup will turn the cells green if there are more than 6 people on shift for Sun-Thu and more than 8 people on shift for Fri-Sat. Adjust the cell references and formatting as needed for your specific setup. The text was created with the help of AI.
My answers are voluntary and without guarantee!
Hope this will help you.
Was the answer useful? Mark as best response and like it!
This will help all forum participants
- steve_laytonMar 21, 2024Copper Contributor
The first formula worked but the second didn't.
If you look at column D the "5" indicates someone is on shift.
The count is at the bottom highlighted in green. D4-D11 =7 people on shift so it turns green.
But it should still be white as it's a Friday and it needs to exceed 8.
Thanks for your help.
- SnowMan55Mar 21, 2024Bronze Contributor
See the attached workbook for alternatives.
- steve_laytonMar 22, 2024Copper ContributorOMG SnowMan55 I don't know how but this worked!!! I used the last option the SWITCH formula and HEY PRESTO it changed green when I needed it to. I didn't really understand the formula or the instruction but it works. Thank you so much for your help!!!