且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Excel - 编程单元格以根据另一个单元格更改颜色

更新时间:2023-02-04 21:43:19

  1. 选择单元格 B3 并单击功能区中的条件格式按钮并选择新建规则".
  2. 选择使用公式确定要设置格式的单元格"
  3. 输入公式:=IF(B2="X",IF(B3="Y", TRUE, FALSE),FALSE),为真时选择填绿色莉>
  4. 创建另一条规则并输入公式 =IF(B2="X",IF(B3="W", TRUE, FALSE),FALSE) 并在为真时选择填充红色.
  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.

更多详细信息 - 带有公式的条件格式会在公式计算结果为 TRUE 时应用该格式.您可以使用复合 IF 公式根据任何单元格的值返回 true 或 false.

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.