Forum Discussion
How to change the background colour of a cell based on content of another cell
- Apr 21, 2022
OK, here's how to do it:
Let's say that the Day cells are D2:D50, and you highlight a cell if it contains "Sun".
And let's say the Date cells are H2:H50.
Select H2:H50. H2 should be the active cell in the selection.
On the Home tab of the ribbon, select Conditional Formatting > New Rule...
Select 'Use a formula to determine which cells to format'.
Enter the formula
=ISNUMBER(SEARCH("Sun",D2))
In this formula, "Sun" is the specific text in the conditional formatting rule for the Day cells, and D2 is the Day cell in the same row as the active cell.
Click Format...
Activate the Fill tab.
Select a colour.
Click OK, then click OK again.
How is the 'Day' cell colored? Using conditional formatting or manually?
- Jon2020Apr 21, 2022Copper ContributorConditional Formatting
- HansVogelaarApr 21, 2022MVP
Thanks. Since there is a 'rule' for the coloring of the Day cells, you can use a modified form of that rule for the Date cells.
It would be helpful to know what conditional formatting rule you're using for the Day cells.
- Jon2020Apr 21, 2022Copper ContributorFormatting only cells that contain - Specific Text