简体   繁体   English

比较同一文件的两个工作表中的数据并突出显示单元格

[英]Compare data in two worksheets of same file and highlight the cell

I am trying to use conditional formatting with comparing two columns on two different worksheets and highlight the cell. 我正在尝试使用条件格式来比较两个不同工作表上的两列并突出显示该单元格。

For example: 例如:

Here is the first worksheet (Sheet_First): 这是第一个工作表(Sheet_First):

Column-A    Column-B        Column-C
————         ————             ——— 
John        SanJose        Electronics
Lisa        Texas          Computer
Patrick     Stanford       Physics
Dave        Newyork        Mathematics

Here is the second worksheet (Sheet_Second): 这是第二个工作表(Sheet_Second):

Column-A    Column-B        Column-C
————         ————              ——— 
Jack        Denver          Electronics
Steve       Dublin          Computer
Shane       London          Physics
Patrick     Stanford        Mathematics

I would need to compare the column “Column-B” from Sheet 1 with Sheet 2, and look for any matching values (irrespective of the order) and highlight the matching cells with a color in column “Column-B” of Sheet2. 我需要将工作表1和工作表2中的“列B”列进行比较,查找任何匹配值(与顺序无关),并在工作表Sheet2的“列B”列中用颜色突出显示匹配的单元格。 In this case, Stanford in the second worksheet should be highlighted. 在这种情况下,应在第二个工作表中突出显示斯坦福大学。

I selected the entire column (Column-B of Sheet_First) and used Conditional formatting with the formula =B1<>Sheet_Second!B1 but it returned an error "you may not use references to other workbooks for conditional formatting criteria” 我选择了整个列(Sheet_First的B列),并使用公式= B1 <> Sheet_Second!B1进行条件格式设置,但返回了错误“您不能将其他工作簿的引用用于条件格式设置条件”

Is this formula correct? 这个公式正确吗? What could be causing this error? 是什么导致此错误?

My version of Excel, Excel 2010, allows to do that out of the box. 我的Excel版本Excel 2010允许开箱即用。 What version do you have? 您有什么版本? Here is a post that list various options for older versions: Format cell color based on value in another sheet and cell 这是一则文章,列出了较早版本的各种选项: 根据另一个工作表和单元格中的值设置单元格颜色的格式

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

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