Need advice re: macro to compare numbers on 2 different s/s for duplicates

Iceberg

Board Regular
Joined
Mar 12, 2008
Messages
79
Hello,

A co-worker has asked me to develop a macro for her. She's pulling two separate reports in SAP and the results get dumped into two separate spreadsheets. The first gives a complete employee listing and the second gives a list of employees who have completed training (both lists contain names and employee numbers).

Since the listings have hundreds of employees, she's looking for a macro that will compare the two. Duplicates will mean that the employee has been trained while single entries mean that the employee hasn't yet undergone training. The output should contain the names and employee numbers, as well as their status (trained/untrained). Since she will be pulling this list several times a month, ideally it would be something that she could run herself.

I've searched similar threads for ideas and am thinking that I may be using VLOOKUP for this. Having said that, I'm a complete VLOOKUP noob and would certainly welcome any advice.

How best do I go about tackling this?

Thanks in advance...!
 

Some videos you may like

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.

GlennUK

Well-known Member
Joined
Jul 8, 2002
Messages
11,539
Yes, I'd use VLOOKUP, or maybe MATCH. Using MATCH the formula might look like this:
Code:
=IF(ISNA(MATCH(employee_cell_ref,employees_trained_range,0)),"Untrained","Trained")

The MATCH function finds the position of a value in a list. You don't care about the position of the employee in the "completed training" list, but you do care if an employee is not on the list at all. When MATCH can't find a matching entry it returns the #N/A! error, which would mean that the employee is untrained. Using the ISNA function tests to see if a result is the #N/A! error.
 

mikerickson

MrExcel MVP
Joined
Jan 15, 2007
Messages
23,920
I'd use Advanced Filter
If Sheet2 is Advanced Filtered using Sheet1 names column (no blank rows) as the criteria range, the duplicates will be shown.
The sheet with the criteria range should be the active sheet when AdvancedFilter is pressed.
 

Watch MrExcel Video

Forum statistics

Threads
1,123,320
Messages
5,600,946
Members
414,417
Latest member
Nobu

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top