简体   繁体   English

在Excel中使用条件格式逐行格式化

[英]Formatting row by row with conditional formatting in Excel

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? 是否有一个公式允许我检查多个记录,或者这需要在VBA中循环? I can only seem to make this work 1 record at a time using conditional formatting. 我似乎只能使用条件格式一次使这项工作成为1条记录。 Thanks! 谢谢!

Edit: Adding results from provided answer 编辑:从提供的答案中添加结果

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列重复

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

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