简体   繁体   English

比较两个列表并突出显示差异

[英]Compare two lists and highlight the difference

I have two lists which I have to compare. 我有两个列表需要比较。

In the first column are item numbers with letters. 第一栏中是带字母的项目编号。

I want to know what the difference between the lists is, one list is the older version and one is the newer version. 我想知道列表之间的区别是,一个列表是较旧的版本,一个是较新的版本。

  • When a row only is in the older version it should be marked red. 如果旧版本中只有一行,则应将其标记为红色。
  • When a row only is in the newer version it should be marked green. 如果新版本中只有一行,则应将其标记为绿色。

I haven't started writing code for this application because I don't know how I can automate it. 我尚未开始为该应用程序编写代码,因为我不知道如何使它自动化。 At the moment I paste the older list under the newer and filter each row individually and then mark then.. That's not working automatically... 目前,我将较旧的列表粘贴在较新的列表下,并分别过滤每行,然后标记它们。。

What you describe can be achieved with conditional formatting. 您所描述的内容可以通过条件格式来实现。 With the old list in column A and the new list in column B, you can apply conditional formatting with a rule: 使用A列中的旧列表和B列中的新列表,您可以使用规则应用条件格式:

  • select column B 选择列B
  • create a conditional format with a formula 用公式创建条件格式
  • use this formula for marking old list values red 使用此公式将旧列表值标记为红色

=COUNTIF(B:B,A1) = COUNTIF(B:B,A1)

  • select the desired format. 选择所需的格式。
  • create another formula for marking only new list values green 创建另一个仅将新列表值标记为绿色的公式
  • use this formula: 使用以下公式:

=COUNTIF(B:B,A1)=0 = COUNTIF(B:B,A1)= 0

  • select the desired format. 选择所需的格式。

Note that there are no $ signs in the cell reference. 请注意,单元格引用中没有$符号。

Adjust the formulas to reflect your lists. 调整公式以反映您的列表。

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

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