简体   繁体   English

Excel条件格式:基于行中值比较的颜色

[英]Excel conditional formatting: color based on comparison of values in a row

how can one format the color of cells according to their values in that row? 如何根据该行中它们的值来格式化单元格的颜色? In this table, I want to give red for the most expensive carrier, green for the cheapest one and orange fro the middle range one, for each row: 在此表中,我想为每行分别给最昂贵的承运人红色,最便宜的承运人绿色和中间范围的橙色。

前表

After conditional formatting, it should look like this: 条件格式化后,它应如下所示: 桌子后

Thank you! 谢谢!

Apply Graded Color Scale conditional formatting, but set the Applies to range to =$B$2,$E$2:$F$2 应用渐变色阶条件格式,但将“ Applies to范围”设置为=$B$2,$E$2:$F$2

Then use format painter to copy this conditional formatting to the rows below. 然后使用格式刷将这种条件格式复制到下面的行中。 You'll end up with a separate rule for each row: 您最终将为每一行得到一个单独的规则:

在此处输入图片说明

Format your colors to suit. 设置颜色以适合您的颜色。

Another way with just two rules is to 'standard' fill with orange as much of ColumnsB, E and F as required, select and clear any CF rules from B:F then HOME > Styles - Conditional Formatting, New Rule..., Use a formula to determine which cells to format and Format values where this formula is true: : 仅使用两个规则的另一种方法是“标准”填充所需的橙色列B,E和F,然后从B:F中选择并清除所有CF规则,然后选择“ HOME”>“样式-条件格式,新规则...”,“ 使用”一个公式,该公式确定要格式化的单元格以及在此公式为真的情况下设置值的 格式

=AND(B1=MAX($B1,$E1,$F1),B1<>"")

Format... , select red Fill, OK , OK . 格式... ,选择红色填充, 确定确定

Add another formula rule of: 添加另一个公式规则:

=AND(B1=MIN($B1,$E1,$F1),B1<>"")

with green Fill. 用绿色填充。

Select ColumnD and Clear Rules from Selected Cells. 选择“ ColumnD”,然后从“选定单元格”中清除“规则”。

In case of ties green will have precedence, unless the rule order is reversed. 如果是平局,除非规则顺序相反,否则绿色优先。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM