简体   繁体   中英

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:

  • select column B
  • create a conditional format with a formula
  • use this formula for marking old list values red

=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

  • select the desired format.

Note that there are no $ signs in the cell reference.

Adjust the formulas to reflect your lists.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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