用Excel中的条件格式逐行格式化

时间:2022-10-29 20:25:16

Let's say I have 2 columns that I'm comparing data in. If both cells match I want both cells to turn green. If they don't match I want them to turn yellow. Is there a formula that will allow me to check this for multiple records, or would this require looping in VBA? I can only seem to make this work 1 record at a time using conditional formatting. Thanks!

假设我有两列用来比较数据。如果两个单元格匹配,我希望两个单元格都变成绿色。如果它们不匹配,我希望它们变黄。是否有一个公式可以让我检查多个记录,或者这是否需要在VBA中循环?我似乎每次只能使用条件格式使这条记录有效。谢谢!

Edit: Adding results from provided answer

编辑:添加来自提供答案的结果。

http://img825.imageshack.us/img825/8420/unledzlf.png

http://img825.imageshack.us/img825/8420/unledzlf.png

1 个解决方案

#1


1  

You can use conditional formatting, but you'll have to format each of the two columns separately.

您可以使用条件格式,但必须分别格式化这两列中的每一列。

Say your data is in A2:B100 (for simplicity)

假设您的数据是A2:B100(为了简单起见)

Select the cells in columnA (A2:A100)
Select conditional Formatting >> New Rule >> Use a formula...
Enter the formula "=A3<>B3", choose a format and click OK

Repeat on column B.

重复列B上。

#1


1  

You can use conditional formatting, but you'll have to format each of the two columns separately.

您可以使用条件格式,但必须分别格式化这两列中的每一列。

Say your data is in A2:B100 (for simplicity)

假设您的数据是A2:B100(为了简单起见)

Select the cells in columnA (A2:A100)
Select conditional Formatting >> New Rule >> Use a formula...
Enter the formula "=A3<>B3", choose a format and click OK

Repeat on column B.

重复列B上。