Excel:值集合的条件格式 [英] Excel: Conditional formatting for clusters of values

查看:94
本文介绍了Excel:值集合的条件格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在EXCEL 2010电子表格中,如何为聚簇单元格值创建交替填充颜色,何时达到新值集群时更改?

In an EXCEL 2010 spreadsheet, how can I create alternating fill color for clustered cell values, changing when a new value cluster is reached?

假设列A包含以下值:

VALUE

123

123

123

456

456

789

789

789

789

像A2:A4中的所有123个值都具有相同的填充颜色(比如绿色),A5:A6中的所有456个单元都是一个新的填充颜色(如蓝色),而所有789个单元格在A7中: A10回到用于123个值的填充颜色(再次绿色)。

I'd like all of the 123 values in A2:A4 to have the same fill color (say, green), all of the 456 cells in A5:A6 a new fill color (say blue), and all of the 789 cells in A7:A10 back to the fill color used for the 123 values (green again).

这与许多重复值示例不同。

This is different from the many duplicate value examples.

这是一个练习,我想反复重复报告,值会动态变化,无法预料。

It's an exercise that I'd like to repeat over and over for reports where the values will change dynamically, and can't be anticipated.

VBA解决方案将会很好。

A VBA solution would be fine.

谢谢。

推荐答案

如果你想要交替的颜色, :

If you want alternating colours, try this:

以蓝色格式化整个范围。将此公式输入帮助列,例如列B,从第2行开始并复制。

Format the whole range in blue. Enter this formula into a helper column, for example column B, starting in row 2 and copied down.

=IF(A2=A1,B1,IF(B1=1,0,1))

然后选择行并添加使用此公式进行条件格式化

Then select the rows and add conditional formatting with this formula

=$B2

选择绿色作为单元格填充。见截图。您可以隐藏列B。

Select green as a cell fill. See screenshot. You can hide column B.

这篇关于Excel:值集合的条件格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆