根据周转时间列中的不同值更改整行颜色

Change the entire row color based on different values in the Turn around time column

我有周转时间列,其中包含永远不会改变的常数,第二列是具有不同数字的结果。我的查询是,如果结果值小于或大于周转时间值,我们是否可以突出显示整行的琥珀色、绿色、黄色。例如:-

If Turn around time is 10, 11, 18 and in the second column value is below 10, 9, 15 or equal to 10, 11, 18 the row color is green

If the second column is 15, 16, 23 that is more than the Turn around time 10, 11, 18 then the row color should be yellow color

If the second column is 20, 21, 28 that is 10 times more than the Turn around time then the entire row color should be amber or red color

列如下:-

请确认我们是否可以使用公式或 VBA 代码解决此查询?

为了清楚起见,我在查询中又添加了一个屏幕截图示例,请确认我们是否可以将负值与 TAT 值进行比较,然后为该行着色。

在下图中,如果您看到第 4 行 TAT 值为 20,则结果值为 -30,如果我将值 30 与 TAT 20 进行比较,则 30 大于 20 但因为它具有负值它没有完美地为行着色,请确认如何解决条件格式中的此类问题

这不是VBA,你需要条件格式。 您使用的是哪个 excel 版本?以下适用于 2007 年及以后。

Select 你的整个 table,从第一行数据开始。确保 select 整行。确保您的活动单元格是 A2! (我假设 TAT 是 A 列,并且您的 table 从第 1 行开始。如果不是,请相应地更改公式。)

转到条件格式,select "New Rule"。选择 "Use a formula to determine which cells to format"。 在 "Format values where..." 框中,输入此公式:

=$B2<=$A2

将格式更改为绿色单元格颜色。

对您的其他条件执行相同操作:=$B2>$A2,单元格颜色为黄色,=$B2>=($A2+10),单元格颜色为红色。规则的顺序很重要。

希望这对您有所帮助,但您应该阅读条件格式。 Chandoo 是一个很好的起点: http://chandoo.org/wp/2009/03/13/excel-conditional-formatting-basics/