Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
71 views

Compare 2 Lists of Data in Excel - Tutorial & Download Example

Uploaded by

Anonymous RQQTvj
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
71 views

Compare 2 Lists of Data in Excel - Tutorial & Download Example

Uploaded by

Anonymous RQQTvj
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 45

Compare 2 lists of Data in Excel - Tutorial & Download Example https://chandoo.

org/wp/compare-2-lists-in-excel/

! Excel Howtos, Featured, Learn Excel

Become a Comparison Ninja – Compare


2 Lists in Excel and Highlight Matches
Last updated on August 19, 2019

Share
" ! Facebook " Twitter # LinkedIn

Chandoo

1 of 45 23/3/21, 12:29 am
Compare 2 lists of Data in Excel - Tutorial & Download Example https://chandoo.org/wp/compare-2-lists-in-excel/

We will learn how to compare 2 lists of data in 3 + 1 different ways. (click on links to jump to Welcome to Chandoo.org
that section of post) Thank you so much for visiting. My aim
is to make you awesome in Excel &
1. Highlight items that are only in first list Power BI. I do this by sharing videos,
tips, examples and downloads on this
2. Highlight items that are only in second list
website. There are more than 1,000
3. Highlight items that are in both lists pages with all things Excel, Power BI,
4. Search and highlight matches in both lists – Home Work Dashboards & VBA here. Go ahead and
spend few minutes to be AWESOME.

Understanding the Comparison Logic: Read my story • FREE Excel tips


book
Whenever you compare 2 sets of values, there are 3 possibilities, as shown in the illustration below:

Apart from looking like circles drawn by hulk with a crayon, these circles show important concepts of Want an AWESOME
set theory in simplest form. Excel Class?
[there is a fourth possibility of a value not being in either lists, we omit that for now]

2 of 45 23/3/21, 12:29 am
Compare 2 lists of Data in Excel - Tutorial & Download Example https://chandoo.org/wp/compare-2-lists-in-excel/

What you need to compare 2 lists?


Excel School made me great at ⋆!
! ⋆!⋆!

work. ⋆
!
1. Of course, you need 2 lists of data. But, just to make formulas simpler and easier to read, lets

name the 2 lists as lst1 and lst2.


– Brenda
Lets assume your data looks like this:

FREE Goodies for you...

2. Also, you should know how to use COUNTIFS Excel Formula, it is so awesome, I wonder why

MS hasn’t called it MAGIC() ?


100 Excel Formulas List

3 of 45 23/3/21, 12:29 am
Compare 2 lists of Data in Excel - Tutorial & Download Example https://chandoo.org/wp/compare-2-lists-in-excel/

20 Excel Templates
Calendars, invoices, trackers and much
more. All free, fun and fantastic.

1. Select values in first

list (assuming the

values are in

B21:B29)
13 Advanced Pivot Table Skills
2. Go to conditional
Power Query, Data model, DAX, Filters,
formatting > add rule Slicers, Conditional formats and beautiful
(related: conditional charts. It's all here.

formatting basics)

3. Select the rule type

as “formula”

4. Write a rule like this:

=COUNTIFS(lst2, B21)=0

4 of 45 23/3/21, 12:29 am
Compare 2 lists of Data in Excel - Tutorial & Download Example https://chandoo.org/wp/compare-2-lists-in-excel/

Highlighting Items that are in Second List Only

− Recent Articles on
Chandoo.org

Advanced
Data
Viz
with
1. Select values in second list (assuming the values are in C21:C28)
Excel –
2. Go to conditional formatting > add rule (related: conditional formatting basics) Live
3. Select the rule type as “formula” Event
4. Write a rule like this: =COUNTIF(lst1, C21)=0 on 26
5. Repeat steps 5-8 as above. March
Come and join
me for a free
Highlighting Values in Both Lists: live event on
advanced
data
visualization
with Excel on
26th March
(Friday).
Details inside.

5 of 45 23/3/21, 12:29 am
Compare 2 lists of Data in Excel - Tutorial & Download Example https://chandoo.org/wp/compare-2-lists-in-excel/

13 to get
formula Department
examples Budget
to really for a
understand Month
Now, it gets interesting as you should apply conditional formatting individually to both lists. it [Homework]

1. Select values in first list (assuming the values are in B21:B29)

2. Set the conditional formatting rule as =COUNTIF(lst2,B21)>0

3. Apply formatting as you want.

4. Now select second list (assuming the values are in C21:C28)

5. Set the conditional formatting rule as =COUNTIF(lst1,C21)>0

6. Again, apply formatting as you want. How to Dynamic


embed Arrays
7. That is all.
Excel Live
files, Masterclass
Searching for a value and Highlighting Matched Items in Both Lists – Your calculators – Replay
Homework: on your
website?
This is another common thing we do. We want to find-out a given value (say in A1) is in the both – Step by
step
lists, first list or second list and highlight all the matches. Like this:
instructions

+ Best of the lot

6 of 45 23/3/21, 12:29 am
Compare 2 lists of Data in Excel - Tutorial & Download Example https://chandoo.org/wp/compare-2-lists-in-excel/

Of course, doing this is very straightforward in Excel once you understand the above 3 things. So I

am leaving this as your home work.

Go ahead, figure this out, practice it on a workbook. When you are satisfied with your result, post

the answers here. Discuss!

Download Example Workbook on Comparing 2 Lists in Excel:

Go ahead and download the example workbook on comparing 2 lists in excel. [download

from mirror]

It also contains the answer to homework above. Play with it and become comparison ninja.

How do you compare lists in Excel?

I often have to compare values in multiple lists (for eg. customers of one product vs. another, defect

status this month vs. last month etc.). I use formulas to compare with-in table. And if I want to

highlight the matches, I use CF.

What about you? How do you compare lists of values in Excel? What formulas do you use? Please

7 of 45 23/3/21, 12:29 am
Compare 2 lists of Data in Excel - Tutorial & Download Example https://chandoo.org/wp/compare-2-lists-in-excel/

Your first name

Your email address


You want to learn

Excel

Power BI

Get FREE Excel + Power BI Tips


Subscribe
Simple, fun and useful emails, once per week.

Learn & be awesome.

! 112 Comments
$ Ask a question or say something...
! Tagged under comparison, countif(), data visualization, downloads, Learn Excel, Microsoft Excel
Conditional Formatting, Microsoft Excel Formulas, named ranges, screencasts, search,
spreadsheets

! Category: Excel Howtos, Featured, Learn Excel

8 of 45 23/3/21, 12:29 am
Compare 2 lists of Data in Excel - Tutorial & Download Example https://chandoo.org/wp/compare-2-lists-in-excel/

COOL INFOGRAPHICS & DATA VISUALIZATIONS EXCEL HOWTOS

Advanced Data Viz with Excel – Live What is XLOOKUP? 13 formula examples
Event on 26 March to really understand it

9 of 45 23/3/21, 12:29 am
Compare 2 lists of Data in Excel - Tutorial & Download Example https://chandoo.org/wp/compare-2-lists-in-excel/

How to embed Excel files, calculators on Dynamic Arrays Live Masterclass –


your website? – Step by step Replay
instructions

10 of 45 23/3/21, 12:29 am
Compare 2 lists of Data in Excel - Tutorial & Download Example https://chandoo.org/wp/compare-2-lists-in-excel/

ose of Excel for comparing 2 lists

0/05/27/comparing-two-lists/

5 Simple & Useful Conditional Image Lookup – How-to show dynamic


2. Formatting Tricks picture in a cell [Excel Trick]

great post, as always !!

here's a twist: what if I wanted to create a validation list on the home work example, using a
single list containing the unique values from both lists? How do I do that?

Rgds,

Martin

Reply

3. Vijay Sharma says:


June 17, 2010 at 2:32 pm

Hi Chandoo,

The Home Work is pretty simple after the above tutorial...

Just add conditional formatting and use the Find function...

=FIND($E$3,A1,1)>0 (case sensitive)


==SEARCH($E$3,A1,1) (non-case sensitive

11 of 45 23/3/21, 12:29 am
Compare 2 lists of Data in Excel - Tutorial & Download Example https://chandoo.org/wp/compare-2-lists-in-excel/

January 17, 2014 at 9:51 am

Can u Explain how to searched a value matched items in both list, i tried many times but i
cant sort it out

Reply

anne marie delprincipe says:


May 18, 2017 at 3:12 am

Can you send me the file that has this conditional formatting with the find function. TY

Reply

4. Gregory says:
June 17, 2010 at 6:45 pm

Something I would consider is looking at all unique values for both lists,which would be the
compliment of customers in both lists.

When you compare two sets of values, as your Venn diagram shows, there are four possibilities:
1) Only in List 1
2) Only in List 2
3) In Both Lists
4) Not in Both Lists (the mathematical compliment to 3)

Reply

5. Alan says:
June 17, 2010 at 9:22 pm

Very good post. I've never considered using CF in this way but can see the possibilities.
Comparing tables I will usually uses vlookup or index/match.

Reply

6. Chandoo says:
June 19, 2010 at 1:59 am

12 of 45 23/3/21, 12:29 am
Compare 2 lists of Data in Excel - Tutorial & Download Example https://chandoo.org/wp/compare-2-lists-in-excel/

/wp/2009/10/15/dynamic-chart-data-series/ )

Reply

BASHA says:
September 12, 2018 at 5:07 am

1)DUPLICATES COMPARING IN TWO LISTS IS OK FOR A SMALL AMOUNT OF DATA.


2)FOR A LARGE AMOUNT OF DATA(LIKE 1 LAKH OR ABOVE) IT IS GETTING STRUCK.....IS
THERE THERE ANYWAY OR METHOD TO STOP IT AND GET RESULTS IN COUPLE OF
MINUTES.

~~THANK YOU CHANDOO..........GARU........~~

Reply

7. sam says:
June 20, 2010 at 12:30 pm

"How do you compare lists of values in Excel"

I just use formulas as criteria in Advanced Filter

Reply

8. Artem says:
June 30, 2010 at 4:08 am

The quickest way to find all about two lists is to select them both and them click on Conditional
Formatting -> Highlight cells rules -> Duplicate Values (Excel 2007). The result is that it
highlights in both lists the values that ARE the same. Then in one list non-highlighted are values
that are not present in the second list, and opposite for the second list. I think it is sell "geeky",
but it gets job done very very quickly when you don't want to mess around.

Reply

sreekumar m k says:
July 24, 2012 at 7:55 am

13 of 45 23/3/21, 12:29 am
Compare 2 lists of Data in Excel - Tutorial & Download Example https://chandoo.org/wp/compare-2-lists-in-excel/

Reply

Jon says:
March 11, 2013 at 4:37 pm

Tried this as a reconciliation tool but it fails as it also highlighted the number if duplicated
in the first list e.g if 2.8 appears twice in list one it is highlighted although not appearing in
list two.

Reply

9. Chandoo says:
June 30, 2010 at 4:44 am

@Artem.. wow, that is cool. Why didnt I think of it.. ?!?

Reply
10. Even Faster Way to Compare 2 Lists in Excel [Quick Tip] | Chandoo.org - Learn Microsoft Excel
Online says:
July 1, 2010 at 8:42 am

[...] week we discussed a fun and easy way to compare two lists of data in excel using
conditional formatting. In that post, Artem commented, The quickest way to find all about two
lists is to select them both [...]

Reply

11. Fernando says:


July 15, 2010 at 7:55 pm

Using Become a Comparison Ninja – Compare 2 Lists in Excel and Highlight Matches topic, how
do I compare data that is non identical. Example US Telepacific Co vs U.S. Telepacific Company.
and sometimes I will have the parent's company name like Brenntag North America Inc vs
Coastal Chemical Co (this being the same company). Can I email you my data so you can give
me the most efficient way to do this? I've tried =IF((LEFT(A1,3))=(LEFT(D1,3)),TRUE,FALSE)
which will compare the first three characters and then I will "eyeball" the rest to match them up.
I have tried vlookups to match the information. Is there another way to do this?

14 of 45 23/3/21, 12:29 am
Compare 2 lists of Data in Excel - Tutorial & Download Example https://chandoo.org/wp/compare-2-lists-in-excel/

comparing the the first characters of the name and eyeballing the rest. Is there a more efficient
to do it. Can I email you a data sample of what I'm talking about? Thank you,

Reply

13. Chandoo says:


July 16, 2010 at 8:04 am

@Fernando.. you mean compare but do not highlight if cell values are synonymous? now that is
an interesting problem.. let me think about it and get back to you..

Reply

14. Kader says:


July 20, 2010 at 2:55 pm

Hi there, I noticed that usisng the solution you provided, for Beth (for instance) it highlights even
Elisabeth (because having the part "beth" in it I guess) using the following conditional format
=AND($B$4"";COUNTIF(B8;$B$4))
instead of the original one i.e: =AND($B$4"";COUNTIF(B8;"*"&$B$4&"*"))
gave the result shown on your page (this one!)

Hope it was helpful


cheers!

Kader

Reply

15. Tim McCollough says:


July 28, 2010 at 9:14 pm

You can do the same using simple boolean operators in lieu of COUNTIF

Highlighting Items that are in First List Only:


=AND(valuelst2) [entered into the conditional formatting for list 1]

Highlighting Items that are in Second List Only:

15 of 45 23/3/21, 12:29 am
Compare 2 lists of Data in Excel - Tutorial & Download Example https://chandoo.org/wp/compare-2-lists-in-excel/

chern says:
June 17, 2015 at 3:29 am

Hi Tim.

Thanks for the tip. I'm very new to excel and was just wondering do you know how to
make excel highlight the duplicate cells concurrently? As per chandoo's GIF. Thanks!

- Chern

Reply

16. Tim McCollough says:


July 28, 2010 at 9:18 pm

The comment engine removed my not equal sign, so replace "not=" with the appropriate symbol
and the following should work.

You can do the same using simple boolean operators in lieu of COUNTIF

Highlighting Items that are in First List Only:


=AND(value not= lst2) [entered into the conditional formatting for list 1]

Highlighting Items that are in Second List Only:


=AND(value not= lst1) [entered into the conditional formatting for list 2]

Highlighting Values in Both Lists:


=OR(value=lst2) [entered into the conditional formatting for list 1]
=OR(value=lst1) [entered into the conditional formatting for list 2]

This method (like COUNTIF) finds exact matches only. To highlight the partial matches like your
.gif file demonstrates for the homework, SEARCH or FIND as suggested by Vijay is the best
solution I think. I don’t run 2007, so the Duplicate Values to me is not useful.

Reply

17. Khushnood Viccaji says:

16 of 45 23/3/21, 12:29 am
Compare 2 lists of Data in Excel - Tutorial & Download Example https://chandoo.org/wp/compare-2-lists-in-excel/

A screen-shot of this setting can be viewed/ downloaded at :


http://docs.google.com/leaf?id=0B-
rjqFlfGuBoYWI4ZTBlYWMtNWIzZC00MzI1LWE4ODgtNzRjZGQ0NWY1MDg2&sort=name&
layout=list&num=50

I've added this as a new sheet in your file itself.


If you want, I can email the file to you for sharing with the rest of us.

Cheers!
Khushnood
Mumbai

Reply

18. rmal says:


August 31, 2010 at 6:09 pm

Hello,

I need help with a formula. I've got two spreadsheets of data. I need a formula that will look at
both lists and find a match of the product number (C2:C400), and if it does match then it will
look at the product price (E2:E400) for a match. I don't care what value is returned for the
matches.

Thank you so much. rmal

Reply

19. Opulentus Overseas Careers says:


September 13, 2010 at 1:01 pm

If u display the steps with the picture that will be more easy to learn.

Reply

20. Mynda says:


September 17, 2010 at 4:53 am

17 of 45 23/3/21, 12:29 am
Compare 2 lists of Data in Excel - Tutorial & Download Example https://chandoo.org/wp/compare-2-lists-in-excel/

Reply

22. cole wheeler says:


October 27, 2010 at 2:39 pm

Chandoo,

@fernando and @Chandoo in regards to comparing lists that are similar but not exact - i have
run across problems on a massive scale and "eyeballing" the matches becomes impossible.

For example - imagine a list of all professors at a university: names come in many formats with
middle initials, two middle initials, PhDs, MDs, and various other issues. The text document is
then split out via "text to columns" and I have little confidence that i can pull last names or first
names out accurately.

I have to then compare those professors to lists of various professional organizations that they
may be affiliated with their own unique lists that may or may not match my professors names 1
to 1. This exercise could be used to see how large the universities network has grown.

The methodology i have used starts with finding last names and concatenating a first initial (eg
SmithP for Peter Smith). Then try the same method with the lists of professional organizations
and attempt to match.

Can you think about more efficient ways to compare non-exact data? Or is Excel not the right
tool for this job?

Reply

23. Chandoo says:


October 28, 2010 at 6:35 am

@Cole... Interesting question.

I generally use a fuzzy match algorithm in cases where I need to match values that have spelling
mistakes, extra spaces etc. Use the below UDF in your conditional formatting and you should be
able to solve good portion of the problem.

http://chandoo.org/wp/2008/09/25/handling-spelling-mistakes-in-excel-fuzzy-search/

18 of 45 23/3/21, 12:29 am
Compare 2 lists of Data in Excel - Tutorial & Download Example https://chandoo.org/wp/compare-2-lists-in-excel/

25. Eric says:


February 2, 2011 at 8:08 pm

lst1, lst2??? I have 2 columns of data. How do I tell Excel which column is lst1 or lst2??? This
does not help me.

Reply

26. Hui... says:


February 2, 2011 at 11:51 pm

@Eric where they have used Lst1 put your range in eg: A1:A20
Or you can name the ranges as well

Reply
27. Quickly Compare Data using Row Differences | Chandoo.org - Learn Microsoft Excel Online says:
February 14, 2011 at 9:09 am

[...] and you want to compare row by row to spot the differences. Of course you can write a
formula or apply conditional formatting. But there is a quick and dirty solution that works just as
[...]

Reply

28. PM says:
April 13, 2011 at 8:20 am

@ Eric: Highlight the 1st list and right click and pick "Name a Range", thats how Chandoo has
defined Lst1 and Lst2.

Reply

29. MAYANK YADAV says:


April 14, 2011 at 10:30 am

@ Eric - hope you have for your answer ! If no then :


You need to name the lists to help Exel identify thesame, for this-

19 of 45 23/3/21, 12:29 am
Compare 2 lists of Data in Excel - Tutorial & Download Example https://chandoo.org/wp/compare-2-lists-in-excel/

large list of company descriptions:


-Fire Damage Restoration
-Fire Damage
-Fire Damage Repiar (spelling mistake purposeful)
-Fire Damage Repair
-Fire Prevention
-Fire Prevention Services

I need to filter the above list for a smaller, but broader set of titles, such as:
-Fire Damage*
-Fire Repair*

But not:
-Fire Prevention
-Fire Prevention Services

But the COUNTIF function doesn't seem to like wildcard words if the wildcard is in another list.
Any ideas?

Reply

31. ian says:


July 21, 2011 at 4:41 pm

You're hairdo is magical.

Reply

32. ian says:


July 21, 2011 at 4:42 pm

Your Hairdo is magical, ahh gramar

Reply

33. Jen says:


September 2, 2011 at 8:45 pm

20 of 45 23/3/21, 12:29 am
Compare 2 lists of Data in Excel - Tutorial & Download Example https://chandoo.org/wp/compare-2-lists-in-excel/

October 24, 2011 at 4:58 am

Hi Chandoo,

I have question we can highlight same value in 2 coloumn, but in example if column a have
3time 101, 101, 101, and colomn b have only 1 time 101. So if i use conditional formetting it
highlight all four cells but if i want 1 from a and 1 from b only means howmany times in column a
that only time in coloum b should be highlighted how that possible ??? ... pls. advice me

Reply
35. Compare 2 Lists Visually and Highlight Matches | Chandoo.org - Learn Microsoft Excel Online
says:
October 27, 2011 at 8:56 am

[...] Compare 2 lists using conditional formatting [...]

Reply

36. sanjay says:


November 4, 2011 at 10:11 am

How to Compare two Data in Excel 2007 with VLOOKUP

Reply

37. Soon says:


November 25, 2011 at 3:39 pm

How can I compare Column A with Column B and Column C and smallest of the 3 in Column D.
Assume they are in the same ROW. Please advise

Reply

38. Hui... says:


November 25, 2011 at 3:53 pm

@Soon
In D2 put =Min(A2:C2)

21 of 45 23/3/21, 12:29 am
Compare 2 lists of Data in Excel - Tutorial & Download Example https://chandoo.org/wp/compare-2-lists-in-excel/

40. chethan says:


January 4, 2012 at 5:01 am

Hi All,
Need help, i have to generate reports weekly and do comparison between last weeks report vs
today's report to know what changes/progress have been happend in recent week.

Reply

41. N-MAN says:


January 13, 2012 at 4:43 pm

Hi all,
Really struggling with this conundrum...

I have to do a comparison between to sets of staff lists, where name that are highlighting in the
first list who do not appear in the second list have left the firm, and people highlighting in the
second list who do not appear in the first are new arrivals.

To further muddy the issue, when I say 'list', what I actually have is one column for 1st names
and another for surnames in both instances.

IE: C(First Name), D(Surname); then H(First Name), I(Surname)

With many thanks in advance...

Reply

42. Mark A says:


January 18, 2012 at 3:17 pm

I've successfully used the =COUNTIF(Lst1,A21) formula originally described above to great
success either in conjunction with conditional formatting (=COUNTIF(Lst1,A21)>0) or stand
alone =COUNTIF(Lst1,A21).

22 of 45 23/3/21, 12:29 am
Compare 2 lists of Data in Excel - Tutorial & Download Example https://chandoo.org/wp/compare-2-lists-in-excel/

and

'Absent' if my data point A21 IS present in Lst1.

Does anyone have any ideas.

Cheers

Mark A

Reply

43. Julia says:


January 24, 2012 at 2:10 pm

Please help me figure this out: I have 2 separate lists.


List 1 has a Column with Serial Numbers, Computer Names, and others; List 2 has a Column with
Serial Numbers and associated Asset #s. I need to match each SN in List 1 to SN in List 2 and
return the Associated Asset# that matches that SN into List 1. In Short, FIND exact SN from List
1 in List 2, return Asset #from LIst 2.

Thanks

Reply

Matt says:
February 17, 2012 at 11:05 pm

If you're using Excel '07 or '10, you can use the VLOOKUP function for that.

=VLOOKUP([sn_cell], ref_cells, colnum_with_asset#s, FALSE)

Say you have this data:


ABCDEF
1 Compname SerialNo AssetTag SerialNo AssetTag
2 ----------------------------------------------------------------------------
3 JOHNDOE 123456 112233 ABC123
4 JANEDOE 112233 223344 XYZ987

23 of 45 23/3/21, 12:29 am
Compare 2 lists of Data in Excel - Tutorial & Download Example https://chandoo.org/wp/compare-2-lists-in-excel/

I've been trying to figure out how to do this in excel for AGES! Seriously! I think I'm going to put
together a sweet spreadsheet evaluating the pros and cons of all the different mold removal
services that I can find to experiment. My bathroom is crazy gross lately, so it will be a good way
to push me towards getting something done about it...

Reply

45. Lawrence Holland says:


March 7, 2012 at 11:19 am

Love your site and formuals.. Very helpful. I need to do excatly what you described in the
beginning: Compare to columns with data and highlight the ones that are matchs in both
columns; the twist is, i need to have the non matches deleted from both columns.

Reply

Chandoo says:
March 26, 2012 at 5:59 am

Hi Lawrence.. thanks for your love and support.

You can do this with VBA. To know the basics, visit http://chandoo.org/wp/excel-vba/

Reply

46. Dmirtriy says:


March 23, 2012 at 6:45 pm

I have three lists:


Customer System Name System Invoice
John Smith John A. Smith #123 123.00
Sam Smith Smith, Sam 55.25
and so on... I need to compare the first list (225 entries) with the second (6450 entries) and
return the Invoice number that corresponds with the first list .

Reply

Chandoo says:

24 of 45 23/3/21, 12:29 am
Compare 2 lists of Data in Excel - Tutorial & Download Example https://chandoo.org/wp/compare-2-lists-in-excel/

I have the same issue as Fernando. I found this site when doing a google search. I have two lists
- both of just the company name (so there is no other data to compare). I need to find out which
ones are duplicates but the tricky part is that they may not be an exact match. For example, list
one may have "Global Company Inc." and list two may have "Global Co." - Is there a way to note
if the names are similar? I usually use =If(Countif(A$2;A$1099,A2)>1,"DUP","") to find
duplicates without deleting them but it only works for exact matches.

Reply

48. rahul says:


April 19, 2012 at 5:26 pm

Dear Chandu,

My salesman from other city sends me an excel sheet on daily sales update. The excel sheet has
31 rows for each date and he enters his sales for the day in the row as per the date. I want that
while he is sending me the data for today, he should not be able to edit/change the previous day
figures (rows). How can I do it ?

Reply

49. JP says:
April 23, 2012 at 3:04 pm

Is "lst1" the name of the worksheet? I have 2 worksheets, 1 list on each, and I'm trying to
identify duplicate entries. Could anyone offer input on how to format this? Many thanks.

Reply

Hui... says:
April 23, 2012 at 3:19 pm

@JP
Chandoo has written several posts on the subject
Type Duplicate into the Google Search Box at the top right of the screen

Reply

25 of 45 23/3/21, 12:29 am
Compare 2 lists of Data in Excel - Tutorial & Download Example https://chandoo.org/wp/compare-2-lists-in-excel/

side. Using the "magic" filter function, you can quick sort out matching or non-matching rows.

Reply

51. Piyush says:


April 26, 2012 at 8:25 pm

Hi Chandoo.

I want to compare the two lists cell by cell.

Ex.
List-1 List-2
ac
bb
ce
dd

I want to find number of cells in list-1 matching with its corresponding cells in list-2.
In above example i want to compare A2 with B2, A3 with B3 and so on.
That means in the example above it should return me 2.

I haven't surfed your site yet, but looks very interesting, i'll surf more often.

Thanks.

Reply

52. steven says:


May 12, 2012 at 5:16 pm

can anyone help me to match 2 colum of serial number in excel 2003 please thanks,

Reply

53. Matt says:


May 14, 2012 at 2:51 pm

26 of 45 23/3/21, 12:29 am
Compare 2 lists of Data in Excel - Tutorial & Download Example https://chandoo.org/wp/compare-2-lists-in-excel/

54. AG says:
May 18, 2012 at 7:27 am

Hi, I am new to the Excell and my question is possibly has been asked before (if that's the case, i
do apologise). I have a problem with matching a data in two lists. One list contains the product
code in one column and product description in another column. The other list contains the
product code and other data (3 or more extra columns) but no product description. How can I
merge both lists so the second list then contains the product description as well (matched to the
appropriate product code). Mind you, both lists are not identical in size and the second list does
not contain all product codes. Thank you for your assistance.

Reply

Matt says:
May 18, 2012 at 2:57 pm

AG,
If you are using Excel '07 or above, you can use the VLOOKUP function to add the
description from List_1 to a column in List_2.
=VLOOKUP(<List2_ProductID_Cell_Ref>, <List1_First_Cell_ProductID> :
<List1_Last_Cell_ProductDesc>, 2, FALSE)
This looks up the ProductID from List_2 and reports back the Description from List_1.

Reply

AG says:
May 21, 2012 at 6:47 am

Thank you Matt for your reply. I have tried to play with this code, but being very
new to this business of Excell, I have trouble to implement it correctly. Can
someone please provide me with step by step description of how to insert it into the
worksheet to make it work? I am using Excell 2010. Cheers, AG.

Reply

Matt says:

27 of 45 23/3/21, 12:29 am
Compare 2 lists of Data in Excel - Tutorial & Download Example https://chandoo.org/wp/compare-2-lists-in-excel/

LIST_2
____J____|____K____|__L__| _____M_____|
1|_ITEM__|_PRICE__|_LOC_|_SHIPPING _|
2|_BWGN_|_$10.00_|__1___|_____$5.00_|
3|_GWGN_|_$12.00_|__2___|_____$5.00_|
4|_RWGN_|_$15.00_|__1___|____$10.00_|
If you wanted to add the description into LIST_2 from LIST_1, you would
enter the following formula into the corresponding CELLs:
N2: =VLOOKUP(J2, $A$2:$B$4, 2, FALSE)
N3: =VLOOKUP(J3, $A$2:$B$4, 2, FALSE)
N4: =VLOOKUP(J4, $A$2:$B$4, 2, FALSE)

And the result would end up looking like this:


____J____|____K____|__L__| _____M_____|_______N_______|
1|_ITEM__|_PRICE__|_LOC_|_SHIPPING _|_____DESC_____|
2|_BWGN_|_$10.00_|__1___|_____$5.00_|_Blue Wagon___|
3|_GWGN_|_$12.00_|__2___|_____$5.00_|_Green Wagon_|
4|_RWGN_|_$15.00_|__1___|____$10.00_|_Red Wagon___|
If your two lists are on different sheets or even in different workbooks, you
would just point the lookup_array $A$2:$B$4 to the correct location for
List_1. Just make sure you make them specific instead of relative by adding
the $ in the lookup_array cell references. Otherwise, as you copy the
formula down (in a large list), it will change the lookup_array location as you
copy the formula down into the other cells.

Reply

55. Ranjit says:


May 18, 2012 at 10:44 am

I have data in excel which reads like this

Account Number & Balance as per actuals.


Account NUmber & Balance as per software.

Now if i want to compare data and find out only those account numbers where balances are not
matching or the uncommon ones.

28 of 45 23/3/21, 12:29 am
Compare 2 lists of Data in Excel - Tutorial & Download Example https://chandoo.org/wp/compare-2-lists-in-excel/

in the family with different balances as per my software and as per bank.

Reply

56. Tom says:


May 18, 2012 at 1:03 pm

All techniques presented here are good, but it's lengthy and it requires some thinking. I Googled
and found the web site below offers several Excel programs that can do the same at lightning
speed, and it does all the hard work for you at a touch of a button.
http://www.excelville.com/profile/Excel-Power-Utilities
In this web site, I found the following programs are extremely helpful:
1/ Synchronized Excel Workbooks Comparison
2/ Find Delete Duplicate Rows
Take a look, and I hope you find what you are looking for.

Reply

Matt says:
May 18, 2012 at 2:47 pm

Excel 07/10 have a "Remove Duplicates" function under the data tab. All of those NOT
FREE pages are only for Excel 2003.

Reply

57. Tom says:


May 18, 2012 at 5:52 pm

Even though it said Excel 2003, but in the description of the "Synchronized Excel Workbooks
Comparison," it said "the program has been tested under Excel 2000 through Excel 2010, and it
all worked as expected."
I bought the program and tried it out using my Excel 2010 at work, it performed beautifully as
expected, and I saved many many hours of tedious work! My worksheets at work have too much
data, and it would be impossible if if I have to do the comparison manually.
I also tried out the "Find Delete Duplicate Rows" program, and again, it worked for Excel 2010
too. I think maybe the programs were developed using an older version of Excel, but with the

29 of 45 23/3/21, 12:29 am
Compare 2 lists of Data in Excel - Tutorial & Download Example https://chandoo.org/wp/compare-2-lists-in-excel/

58. praveend says:


July 7, 2012 at 10:10 am

Hai,

I want to compare two clumns, consedering one column is standard and the another column is to
check with that statard column and i want to highlight the another column with color. pls help to
get the problem solved.

Thanks and regards,


Praveen

Reply

Matt says:
July 9, 2012 at 3:52 pm

If you are using Excel 2007/2010, you can use conditional formatting to highlight the
Matched cells. In the example below, Column C contains your lookup formulas (i.e.,
=IF(MATCH($B1,$A$1:$A$10000,0),”*”,””)). Then you would highlight Column C and
choose your conditional formatting (Home tab) to only highlight the cells that contained an
asterisk (*).
_*_|__A__|__B__|_C_
_1_|_abc_|_www_|___|
_2_|_cde_|_xyz_|_*_|
_3_|_fgh_|_def_|___|
_4_|_xyz_|_cde_|_*_|

Reply

59. Jeff says:


July 23, 2012 at 2:07 pm

Hello - I have succesfully used the countif function in the past for comparing lists, but am
running into some issues wher I cannot figure out why the countif function is not finding
matches. Using the Conditional Formatting trick above is way cool, but did not work either, so I

30 of 45 23/3/21, 12:29 am
Compare 2 lists of Data in Excel - Tutorial & Download Example https://chandoo.org/wp/compare-2-lists-in-excel/

150M-2FA

150M-3FA

150M-5FA

200M-5FA

200M-71/2FA

2C100PE

CT05FAB

2C100

But 2C150 does work - don't get it!

Thanks - Jeff

Reply

Jeff says:
July 23, 2012 at 2:23 pm

Here is the comparison list values that are not wroking - they look identical, but can't find
each other, unless I manually retype them over replacing whatever formatting issue they
were having.
One list came from an excel sheet, the other from a copied PDF file, with paste special as
values

125M?2FA

125M?3FA

150M?2FA

31 of 45 23/3/21, 12:29 am
Compare 2 lists of Data in Excel - Tutorial & Download Example https://chandoo.org/wp/compare-2-lists-in-excel/

2C100

-Jeff

Reply

Matt says:
July 23, 2012 at 3:48 pm

Here's a quick solution: I put your first list in Col A and the second in Col C (so you
have reference in the formula), and then the formula in Col F.
I simply had it lookup the value and return it if it was found.
=IF(NOT(ISERR(FIND("-",A1))),VLOOKUP(REPLACE(A1,FIND("-",A1),1,"?"),C$1:C$10,1,FALSE),VLOOKUP(A1,C$1:C$10,1,FALSE))
It basically states that IF the formula FINDs "-" in the ref cell, to do a VLOOKUP of
the value, REPLACEing the "-" with a "?" when it looks it up. If it doesn't find "-"
then it does a VLOOKUP for the unmodified cell value.
So,
125M-2FA = 125M?2FA
125M-3FA = 125M?3FA
150M-2FA = 150M?2FA
150M-3FA = 150M?3FA
150M-5FA = 150M?5FA
200M-5FA = 200M?5FA
200M-71/2FA = 200M?71/2FA
2C100PE = #N/A
CT05FAB = CT05FAB
2C100 = 2C100

Reply

Jeff says:
July 23, 2012 at 5:29 pm

Matt,

32 of 45 23/3/21, 12:29 am
Compare 2 lists of Data in Excel - Tutorial & Download Example https://chandoo.org/wp/compare-2-lists-in-excel/

2C150)/ The only way I got it to matach was by typing over the "2" in the
second data set "2C100". Obviously not a solution for comparing large data
sets.

Best Regards - Jeff

Reply

Matt says:
July 23, 2012 at 5:43 pm

The 2C100 was finding the identical match. It was the 2C100PE that
turned up N/A. I didn't account for that in the formula. You could just
add another nested IF statement to account for extra characters at the
end if it's going to be relatively patternistic.
You may want to check out this Fuzzy Search add-in. I may solve the
problem: http://www.microsoft.com/en-us/download
/details.aspx?id=15011

60. sreekumar m k says:


July 25, 2012 at 5:24 am

Hi friends,

We can use vlookup to compare two lists. If you want to search the existence of one list in
another list, write vlookup function after the bigger list and select the smaller list as the table
array. And drag up to the end of bigger list so that we get the values in the smaller list in the
respective position and rest of the cells shows #N/A error.If your bigger list is A2:A95 and
smaller list is C2:C9 then,
Here is the formula:

VLOOKUP(A2,$C$2:$C$9,1,0)

This is a simple method if you want to filter out a list of records from a big database

Just try this guys..

33 of 45 23/3/21, 12:29 am
Compare 2 lists of Data in Excel - Tutorial & Download Example https://chandoo.org/wp/compare-2-lists-in-excel/

this out...I don't have time to read all the replies at the moment!
Andy.

Reply

62. Mirunalini S says:


July 27, 2012 at 6:54 am

Hi,

I need a help,I am trying to compare two sheets with reports of different environment say dev
and prod,i will have two columns matching in both list,I have to pick exactly matching records(i.e
first and third column match) and fetch the matching records one after another in new sheet to
get the average time taken in dev and prod.I am trying with macro but still i am getting
unformatted result.can you help me on this?

Sub Compare()
' Macro1 Macro
' compare two different worksheets in the active workbook
CompareWorksheets Worksheets("Sheet1"), Worksheets("Sheet2")
End Sub

Sub CompareWorksheets(ws1 As Worksheet, ws2 As Worksheet)


Dim dupRow As Boolean
Dim r As Long, c As Integer, m As Integer, k As Integer
Dim lr1 As Long, lr2 As Long, lc1 As Integer, lc2 As Integer, lr3 As Long
Dim maxR As Long, maxC As Integer, cf1 As String, cf2 As String
Dim dupCount As Long
Application.ScreenUpdating = False
Application.StatusBar = "Creating the report..."
Application.DisplayAlerts = True
With ws1.UsedRange
lr1 = .Rows.Count
lc1 = .Columns.Count
End With
With ws2.UsedRange

34 of 45 23/3/21, 12:29 am
Compare 2 lists of Data in Excel - Tutorial & Download Example https://chandoo.org/wp/compare-2-lists-in-excel/

dupRow = False
Application.StatusBar = "Comparing worksheets " & Format(i / maxR, "0 %") & "..."
For r = 1 To lr2
For c = 1 To 3
If (c = 2) Then
GoTo 46
End If
ws1.Select
cf1 = ""
cf2 = ""
On Error Resume Next
cf1 = ws1.Cells(i, c).FormulaLocal
cf2 = ws2.Cells(r, c).FormulaLocal
On Error GoTo 0
If cf1 = cf2 Then
dupRow = True
Exit For
Else
dupRow = False
End If
46: Next c
If dupRow Then
Exit For
End If
Next r
If dupRow Then
dupCount = dupCount + 1
ws1.Range(ws1.Cells(i, 1), ws1.Cells(i, maxC)).Select
Selection.Copy
Worksheets("Sheet3").Select
Worksheets("Sheet3").Range(Worksheets("Sheet3").Cells(lr3, 1),
Worksheets("Sheet3").Cells(lr3, maxC)).Select
Selection.PasteSpecial
lr3 = lr3 + 1
ws2.Select
ws2.Range(ws2.Cells(i, 1), ws2.Cells(i, maxC)).Select

35 of 45 23/3/21, 12:29 am
Compare 2 lists of Data in Excel - Tutorial & Download Example https://chandoo.org/wp/compare-2-lists-in-excel/

' Selection.Font.Bold = True


'Next t
End If
Next i
Application.StatusBar = "Formatting the report..."
'Columns("A:IV").ColumnWidth = 10
m = dupCount
Application.StatusBar = False
Application.ScreenUpdating = True
MsgBox m & " Rows contain different values!", vbInformation, _
"Compare " & ws1.Name & " with " & ws2.Name
End Sub
thanks
Mirunalini S

Reply

63. Radha says:


January 11, 2013 at 10:23 pm

The above formula works when there is an exact match between two lists. i.e
List 1 List 2
ATT ATT
Verizon VERIZON
Sprint Sprint.......

Question:
But i want to match and highlight two lists which has similar names.
Example:
List 1 List 2
Airtel Airtel Pvt Ltd
BSNL BSNL Public Ltd
Tata Tata Sky Ltd
JP Morgan J.P. Morgan
Southwest United
Alaska Virgin

36 of 45 23/3/21, 12:29 am
Compare 2 lists of Data in Excel - Tutorial & Download Example https://chandoo.org/wp/compare-2-lists-in-excel/

(Since they have similar match in List 1).


-----------------------------------------------------------------------------------
What did i try?
For Exact Matches : I tried conditional formatting.
(For Similar Matches : ?????)

Reply

64. Ferry says:


January 15, 2013 at 9:15 am

How did you define the variable lst1 and lst2?

Reply

Matt says:
January 15, 2013 at 3:20 pm

You can name a cell range by highlighting it and then typing the name you want to give it
in the cell-reference field above Column A. Excel will know that the name you gave it
refers to the cell range from that point on.

Reply

Ferry says:
January 16, 2013 at 8:33 am

Thanks a ton. It really helped.

Reply

65. Doug says:


February 12, 2013 at 11:45 pm

One note: I worked through these examples, and they did not work at first - until I figured out
that you had created "lst1" and "lst2" as named ranges within the spreadsheet. That may have
been obvious to so some, but I was scratching my head for a while. You may want to mention

37 of 45 23/3/21, 12:29 am
Compare 2 lists of Data in Excel - Tutorial & Download Example https://chandoo.org/wp/compare-2-lists-in-excel/

this is NOT helpful. Don't have time to do "homework" while working under deadlines! And - how
do you create a list? Used to know and EASILY access this info in Excel versions prior to 2007,
now everything is renamed and hidden - TERRIBLE new programs :/

Reply

67. Matt says:


June 28, 2013 at 6:38 pm

This is a bloody terrible tutorial. It doesn't work for new versions of excel, and is poorly
explained. It is a shame that it comes up in the crappy Bing help search.

Reply

Hui... says:
June 29, 2013 at 4:22 am

@Matt

Having a bad day hey ? (The tutorial doesn't work and Bing is Crappy)

This tutorial works quite well in Excel 2010 and Excel 2013, so you must have a newer
version of Excel than me!

I haven't tested it on a Mac though.

Instead of just slamming it, maybe you could help Chandoo and all of us by telling us what
works and what doesn't. Where abouts does it not work etc

Hui...

Reply

68. Stefan says:


August 26, 2013 at 11:45 pm

Hi,

38 of 45 23/3/21, 12:29 am
Compare 2 lists of Data in Excel - Tutorial & Download Example https://chandoo.org/wp/compare-2-lists-in-excel/

Reply

Hui... says:
August 27, 2013 at 5:08 am

@Stefan

Are you able to post a sample file?


Refer: http://chandoo.org/forums/topic/posting-a-sample-workbook

Reply

Stefan says:
August 27, 2013 at 6:11 pm

Hi Hui,

Here is the link.

Thanks
Stefan

Reply

69. Stefan says:


August 27, 2013 at 6:12 pm

https://www.dropbox.com/s/a9dcbhk8lpu7glb/Stefan%27s%20sample.xlsx?m

The link

Reply

70. Jeremy Brydges says:


December 12, 2013 at 10:28 pm

I am currently performing DAILY updates to a table. The table has 19 columns, and the # of rows

39 of 45 23/3/21, 12:29 am
Compare 2 lists of Data in Excel - Tutorial & Download Example https://chandoo.org/wp/compare-2-lists-in-excel/

If possible set up data import as a table. This will automatically extend or remove rows as
needed. If the extra columns are calculations, they will be re-done upon data import.

Reply

71. Jeffrey Kohl says:


February 25, 2014 at 10:22 pm

I really need your help!

I'm comparing two columns. I'm taking each cell from column A (A1, A2, A3, etc...) and using
the ISNA(MATCH function to compare with the entire column of B to see if there is a match. That
is working fine and everything but I just encountered a problem with case-sensitive characters.

For example, cell A4 is Adams dui and in column B there is an Adams DUI. It is indicating that
this is a match when in reality it is not. Do you have another formula that would also check for
case-sensitive characters?

Reply

Matt says:
February 26, 2014 at 12:33 am

You'll have to use COUNTIF, which is case-sensitive in place of MATCH. It will return a 0 if
the item is not found.

A1 = Adams DUI
B1 = adams dui
B2 = Adams dui
B3 = Adams DUI
C1 = COUNTIF(B:B,A1) == 1

A1 = Adams DUI2: C1 == 0

-- Matt

Reply

40 of 45 23/3/21, 12:29 am
Compare 2 lists of Data in Excel - Tutorial & Download Example https://chandoo.org/wp/compare-2-lists-in-excel/

Matt says:
February 26, 2014 at 7:15 pm

Have you tried using the EXACT function?

Reply

Matt says:
February 26, 2014 at 7:19 pm

Here's a good use of the MATCH, INDEX, and EXACT functions all combined to make a
rock-solid case-sensitive solution:

http://www.notjustnumbers.co.uk/2013/09/excel-tip-case-sensitive-vlookup.html

Reply

73. Jeffrey Kohl says:


February 26, 2014 at 9:08 pm

Exact function won't work because it'll only cross-reference the cells in that string. A coworker of
mine found the formula:

{=INDEX(B:B,MATCH(TRUE,EXACT(A2,B:B),0))}

It's an array formula so you have to do CTRL+SHIFT+ENTER

This checks each cell in column A starting with A2 and looks for an exact match in column B. If
there is, it'll populate their name. If there isn't, it'll return a #N/A. If you find all the #N/A's, then
you found all the cells that aren't identical

Reply

74. Nichole says:


April 3, 2014 at 5:37 pm

Hi,

41 of 45 23/3/21, 12:29 am
Compare 2 lists of Data in Excel - Tutorial & Download Example https://chandoo.org/wp/compare-2-lists-in-excel/

Reply

75. Irene Williams says:


August 4, 2014 at 3:35 pm

Good morning, I am *so close* to my solution but I can't figure out what I'm doing wrong! Hope
you can help me:

I am using =COUNTIF conditional formatting to compare two lists; I want to highlight the values
in List1 that are not in List2. My problem is, I have duplicates I want to keep in List1, and when I
use the formula =COUNTIF(List1,N3)=0 (where N3 is the first cell of List2), SOME of the values
in List1 are highlighted, but some aren't!

For example: In List1 I'll have the value 100332965 repeated in D1, D2, and D3 (where this
value does NOT appear in List2), but only D1 and D2 will have returned the highlighted format,
with D3 unformatted! I am racking my brain to figure out why that would be and I just can't get
it. Any help you could provide would be *much* appreciated!

Reply

Matt says:
August 4, 2014 at 11:42 pm

Without knowing what version you are using, I created two lists and did a conditional
formatting similar to what you are describing.

In each list I had six cells, the first list (A1..A6) I had 123 repeated 3x and 234 repeated
3x. In the second list (B1..B6) I had random numbers, but replacing one with 123.

Then in the Conditional Formatting "Use a Formula..." option, I highlighted all of the the
cells in the first list and then entered =COUNTIF(B$1:B$6,A1)=0. I think your idea is
correct, but you may be reversing the references to your formula. Try reversing your
values and have either =COUNTIF(List2,List1)=0 or =COUNTIF(List2,[first cell of List1])=0
and see if that helps any.

Reply

Irene Williams says:

42 of 45 23/3/21, 12:29 am
Compare 2 lists of Data in Excel - Tutorial & Download Example https://chandoo.org/wp/compare-2-lists-in-excel/

76. Sophia says:


September 26, 2014 at 7:07 am

Hi,

I was using the formula =COUNTIF(firstlist,B1)=0 in order to compare two pretty extensive list of
names. I had named the range for the first list, "firstlist" and name the second list, "secondlist."
The issue was that it would highlight the entire column. Odd, so I went in to compare some
names and noticed that there were repeated names that were still being highlighted even though
they were duplicates. I'm not sure what I am doing wrong.....
The names are also formatted as so: name/location
So, I'm not sure if capitalization had anything to do with it or if the slashes did either. HELP
PLEASE!

Reply

77. Jamal says:


February 22, 2016 at 9:33 am

Hi
Suppose I have 04 columns and i want to compare first row of these columns.I want to highlight
a column if the difference between the columns is 02 times greater.

Reply

78. Sandy says:


April 7, 2016 at 10:14 am

Hello, Thank you guys for your help. now i have a question.

I use the conditional formatting to compare two lists, not i have to lists of numbers, bank
transaktions. Im trying to find matches. I can do that using countif. Im tring to see which
banktransaktions match eachother, same value, i want the cell to be colours so i know they
match. However, doing it this way is not that good, because, lets say i have the value 200 in one
list. and it apears in the second list i have that value multipule times, then they all get coloured
in/not coloured in depenting on my formula. Now how do i write something so that it only
"registers" the 200 one time. I want to find one match for each value and not multiple.

43 of 45 23/3/21, 12:29 am
Compare 2 lists of Data in Excel - Tutorial & Download Example https://chandoo.org/wp/compare-2-lists-in-excel/

Reply

Leave a Reply

44 of 45 23/3/21, 12:29 am
Compare 2 lists of Data in Excel - Tutorial & Download Example https://chandoo.org/wp/compare-2-lists-in-excel/

goodness. Join 100,000+ others and get it free.

Yes, sign me up %

GET STARTED ONLINE CLASSES ABOUT DOWNLOADS

Excel Basics Excel School My Story 20+ Excel Templates

Advanced Excel VBA Classes Welcome Message 200+ Dashboards

100+ Formulas Power BI Classes Contact 40+ VBA Code samples

Free Crash Course 50 ways to analyze data Forum & Community Ebooks & More

Pivot Tables

Power BI

" $ % &
© All rights reserved.

45 of 45 23/3/21, 12:29 am

You might also like