【问题标题】:conditional formatting rules for a cell value - absolute value单元格值的条件格式规则 - 绝对值
【发布时间】:2015-07-24 19:08:36
【问题描述】:

我正在使用 Excel 2013。

我在单元格上使用条件格式。我使用功能区上的突出显示单元格规则选项添加了 3 条规则。

我的单元格包含一个公式。在另一个单元格中是一个公差级别的值,我们将此值称为 tol。

我当前的条件格式执行以下操作,效果很好,

If my cell is less than tol * 0.8 then colour it green
If my cell is between tol * 0.8 & tol * 0.9 then colour it yellow
If my cell is greater than tol * 0.9 then colour it red

但是我的单元格值可以是负数,我只关心单元格的绝对值。当否定时,我的规则会将其着色为绿色,这可能不正确,请参见下面的简单示例。

My Cell        Tolerance Level       Outcome I want     My Current Result
75             100                   Green              Green
85             100                   Yellow             Yellow
95             100                   Red                Red
-75            100                   Green              Green
-85            100                   Yellow             Green
-95            100                   Red                Green

编辑

我无法使我的单元格值成为绝对值。需要看什么时候负数

【问题讨论】:

    标签: excel


    【解决方案1】:

    只需为负值添加与正值相同的格式

     If my cell is between tol * -0.79 & tol * 0.79 then colour it green
     If my cell is between tol * 0.8 & tol * 0.9 then colour it yellow
     If my cell is greater than tol * 0.9 then colour it red
    
     If my cell is between tol * -0.8 & tol * -0.9 then colour it yellow
     If my cell is less than tol * -0.9 then colour it red
    

    【讨论】:

      【解决方案2】:

      根据一个公式创建三个规则;每个都使用ABS function

      =ABS(cell/tol)<0.8                            'for green
      =AND(ABS(cell/tol)>=0.8, ABS(cell/tol)<=0.9)  'for yellow
      =ABS(cell/tol)>0.9                            'for red
      

      例子:

      =ABS($A2/$B2)<0.8
      =AND(ABS($A2/$B2)>=0.8, ABS($A2/$B2)<=0.9)
      =ABS($A2/$B2)>0.9
      

              

      【讨论】:

        猜你喜欢
        • 2011-08-08
        • 2023-02-06
        • 2015-10-05
        • 2015-02-05
        • 2021-10-16
        • 2019-01-27
        • 2014-10-29
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多