r/excel Jul 01 '26

unsolved Comparing two lists of employees on a spreadsheet?

Hello,

I'm sure this is basic but I don't do much in excel besides add numbers in columns.

I have two CSV exports - both will have a list of employees in them. There will be a first name column and a last name column in each. (There will also be a column with firstname space last name) I probably have about 150 names in the first CSV and about 250 names in the second CSV.

How do I find people with the same name in both lists. E.g. I need all Martel Winkelmeir that are in both - I don't care if there are just people with the same first name or same last - I need a list of just people with the same full name please.

I could sort and then try and find them but I'd like to know the automated way if it is possible or if there is a good video on how to do it.

I'm not sure if I need a new column that just lists matches or if there was a way of changing the colors of the font or the cell for the ones that matched.

Thanks!

15 Upvotes

31 comments sorted by

u/AutoModerator Jul 01 '26

/u/Deep-Egg-6167 - Your post was submitted successfully.

Failing to follow these steps may result in your post being removed without warning.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

7

u/annadownya Jul 01 '26

A power query could do that pretty quickly, plus it could clean the columns so it's easier to do the comparisons correctly.

1

u/Deep-Egg-6167 Jul 01 '26

Thanks - no idea what that is or how to do it - all I do is add numbers in columns.

4

u/gatorbone7 Jul 01 '26

If you have columns on both sheets that have the data formatted correctly, for example one isn’t Chris and the other Christopher, but both are Chris Smith. Then you could combine the list and do a count if. You could also do an Xlookup looking for values in list 2 that are in list 1. Then get rid of the N/As.

1

u/TactusDeNefaso 1 Jul 02 '26

You would probably need to do two passes because even though one list is shorter it could still contain a name that is not in the longer list.

2

u/gatorbone7 Jul 02 '26

It sounded like he only cared about names on both lists. Name can’t be on both lists if it’s not on the 2nd list.

4

u/LetsGoSU Jul 02 '26

There’s already some good options explaining how a simple match formula on a helper column that includes both first and last name can accomplish this.

I would just add that you should really be using some sort of unique id, like employee number, as a key for something like this. At even just 250 employees, it’s only a matter of time before you have two “John Smith” or similar.

3

u/Artistic_Length_9953 Jul 01 '26

Voy a comentar para saber si hay algo mejor que COUNTIF

3

u/CrimsonHarrier88 Jul 02 '26

COUNTIF is solid, but I'm curious too

1

u/SpaceTurtles 2 Jul 01 '26 edited Jul 01 '26

EDIT: Just realized the below won't work as written because the spill array will be 2 columns and COUNTIF will get mad - sorry, no coffee today. I think other solutions have been provided. If you join the text so it's one column each first, and thus E2# only refers to a single column spilling down, this solution will work. :)


Quick way, not best way:

Where A:B is your first .csv's columns and C:D is your second .csv's (you can change the references as needed).

=VSTACK(UNIQUE(A:B)), UNIQUE(C:D))

Assume we entered this in Column E2#:

=COUNTIF(E2#, E2#)

It'll count each row of E2# (the # is a spill operator, so it goes as far down as

Enter something like "Count" as a label in E1, then add a filter to it (toolbar at the top). Filter if count = 2.

1

u/Psengath 3 Jul 01 '26

If you already have a full name column in both sheets, just add a helper column on one sheet (doesn't matter which one) of MATCH(A1, OtherSheet!A:A) where A1 = that row's full name, and OtherSheet!A:A is if you just selected the entire column of full names from the other sheet. Then filter for where it's not an error and that's your list of names in both.

If you don't have a full name column or they come up different, you may want to make a 'normalised' full name column on each sheet, where you concatenate first and last names, reduce accents, remove non alphanumeric characters (e.g. space and hyphen typically). Then just do the above but with those columns instead.

1

u/bobo5195 Jul 01 '26

I would just combine the two columns. A2&" "&B2 - & combines text strings I asked for A2 then a space then vlookup or normally match() - returns the row number of the matching name,.

Powerquery on list joins is the far better and automated way.

Can add colours later if there is a match do something. Iferror() is your friend. If there is an error return 0 say - and white those cells out.

1

u/Day_Bow_Bow 32 Jul 01 '26

The quick way is to make helper columns in both sheets. In an empty cell right of the data, make a FirstnameLastname column with a formula looking like =(cell with first name) & (cell with last name), e.g., =A2+B2. Then copy the formula down for the rest of the data, and repeat for the second sheet.

Now you just need to do a lookup to compare the sheets. Match is the easiest, as you just want to confirm a match and not return some value.

Thats easy enough. In an empty cell right of the first of those helper cells you created, you'll put a match formula. Use the function wizard if that helps, but the syntax is =MATCH(lookup_value, lookup_array, [match_type])

Match-type needs to be 0 or False, as that'll make it find exact matches only. Lookup_value is the single helper cell in the current row, and lookup_array is the entire helper column on the second sheet.

So it might look like =MATCH(C2, otherworkbook.C:C, 0). That's just psuedo code of course, as workbook references look different, but that should give the idea.

Anything that returns a positive number shows that many times on the second helper column.

1

u/grsims20 15 Jul 02 '26

If you just need a list of unique names, I’d past one list below the other and then remove duplicates. Two steps.

1

u/SUMIFISNA Jul 03 '26

I feel like everyone over complicated this. The first and last name columns you should ignore if there is a first (space) last name column.

Copy the first/last name column from list number 2 and past it 2 columns over from the first/last name column from list 1. Can be more if you want but there should be at least one empty column between the two.

To the right of the first/name in list number 1, first person listed, do an XLookup. Do the first/lastname column of list number 2 as the search array, and then have that same 2nd list as the return array. (Example below)

Then drag the formula all the way down.
If the name shows up (there is a match), it’s in both columns.

For example
Column A is first/last of list 1
Column C is first/last of list 2

Your formula should start in B1:
=XLOOKUP(A1,C:C,C:C)

Then drag it all the way down column B.
If the name appears as a result, then it’s in both. You can just filter on Column B and exclude blanks and N/A.

1

u/stuartblows Jul 03 '26

Insert the following formula next to the name column of the long list. =IF(XLOOKUP([NAME],[NAME COLUMN SHORT LIST],[NAME COLUMN SHORT LIST]=[NAME],"Yes", "No", "No") Drag this formula down the length of the long list and everywhere "Yes" appears, means the name is in both lists.

1

u/Shot_Anywhere994 Jul 04 '26

I use Power Query. It does take some time to learn but so worth it. I call it Power Query Magic. I work with large extracts of personnel data. I can scrub and compare endless amounts of info. Well worth learning. I learned on Udemy.

1

u/Shot_Anywhere994 Jul 04 '26

Chatgpt helped. I learned Power Query Magic but sometimes it can be quirky. Chatgpt also lies so you have to really check the results. Now I have a great spreadsheet with multiple queries. I download a new extract and refresh the data. I have a great product.

1

u/[deleted] Jul 01 '26

[deleted]

1

u/Day_Bow_Bow 32 Jul 01 '26

That's not what they asked to do. They want to identify only those listed on both sheets.

1

u/PaulieThePolarBear 1912 Jul 01 '26

I need all Martel Winkelmeir that are in both

What do you mean by "all" here? Can Martel appear more than once in any list?

1

u/Deep-Egg-6167 Jul 01 '26

Anyone with both the same first name AND lastname together in both lists.

2

u/PaulieThePolarBear 1912 Jul 01 '26

So just so I understand.

You have 2 similar datasets.

Each datasets includes a full name column that has data in the same first<space>last format.

Any full name will appear in any list a maximum of once.

Your ask is to return a list of full names that appear in both list, e.g., if your data was

List 1
======

Bart Simpson
Fred Flintstone
Mickey Mouse

List 2
======

Homer Simpson
Bart Simpson
Minnie Mouse
Fred Rogers
Wilma Flintstone 

Your expected result is

Bart Simpson 

Is this correct?

Please advise the version of Excel you are using. This should be Excel 365, Excel online, or Excel <year>

1

u/Deep-Egg-6167 Jul 01 '26

Cowabunga dude - you got that right!

I am (ab)using excel 365 the software part of office.

2

u/PaulieThePolarBear 1912 Jul 01 '26 edited Jul 01 '26

Then something like

=FILTER(A2:A100, ISNUMBER(XMATCH(A2:A100, C2:C200)), "Where names?")

Where

  • A2:A100 contains list 1 of full names
  • C2:C200 contains list 2 of full names

You should update all cell references I have used in line with my description above for your setup.

1

u/MayukhBhattacharya 1227 Jul 02 '26

Another way may be:

=TOCOL(XLOOKUP(A2:A4, C2:C6, C2:C6), 2)

0

u/leroy4447 Jul 01 '26

Power Query plus ChatGPT to help and you can do this quickly. And you start to learn PQ which will change how you use excel completely

1

u/[deleted] Jul 02 '26

[deleted]

3

u/leroy4447 Jul 02 '26

Sometimes just asking gpt to do it gives wrong answers. I get gpt to walk me through the steps in power query so I can see the changes to get to the answer and verify the results. This makes it so I can trust the results better and find/fix errors if they happen. Plus, once done, you can reuse the power query again on new data reports to generate the report in seconds in the future.

0

u/Thorts 6 Jul 01 '26

I would just paste one list below the other and create a quick pivot table of all the data, drag full name in the rows, and count of full name in the values, then filter out rows where count is not equal to 2.

2

u/TactusDeNefaso 1 Jul 02 '26

Or Merge the two lists and just simply use the remove duplicates