Excel - programm cells to change colour based on another cell

前端 未结 3 1306
没有蜡笔的小新
没有蜡笔的小新 2021-01-13 14:20

I am trying to create a formula for Excel whereby a cell would change colour based on the text in the previous cell.

So for example if cell B2 contains the letter X

3条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-13 14:39

    1. Select cell B3 and click the Conditional Formatting button in the ribbon and choose "New Rule".
    2. Select "Use a formula to determine which cells to format"
    3. Enter the formula: =IF(B2="X",IF(B3="Y", TRUE, FALSE),FALSE), and choose to fill green when this is true
    4. Create another rule and enter the formula =IF(B2="X",IF(B3="W", TRUE, FALSE),FALSE) and choose to fill red when this is true.

    More details - conditional formatting with a formula applies the format when the formula evaluates to TRUE. You can use a compound IF formula to return true or false based on the values of any cells.

提交回复
热议问题