Solved

Excel - to match employees from multiple lists

Posted on 2016-08-04
4
66 Views
Last Modified: 2016-08-04
Hi All - I need your assistance with Excel. I have a worksheet with the following columns.

EmployeeNumber (Column A), Employee_Name (Column B), EmployeeName (Column C),username (Column D) ,email (Column E) and Employee_Number (Column F)

Column A and column B contains the employee numbers and names for a single department, however, the rest of the columns C, D, E, and F contain employee information for the entire company (but column F is sometimes blank.)

The number of employees for a single department are about 700  and the total number of the entire company is about 50000,

I would like to check if the employee from employee_name (column B) exist in the EmployeeName (Column C), if it does then get the ,username (Column D) ,email (Column E) and Employee_Number (Column F)  for the employee to be copied to another sheet. if employee_name (column B) does not exist in EmployeeName (Column C) then ignore.

Is it possible to automated this rather than manual? It will take me a log time if I do this manually.

I have attached a sample spreadsheet, there are two worksheets, worksheet 'Before' contains all columns and worksheet 'After' contains the results.

I hope my explanation make sense, if not please by all means ask me question.

Many Thanks
Jose
Example.xlsx
0
Comment
Question by:jose11au
  • 2
4 Comments
 
LVL 49

Expert Comment

by:Rgonzo1971
ID: 41742186
Hi,

You could use a helper's column to filter the data

=ISNUMBER(MATCH(C2,B:B,0))

Open in new window

But beware with such a large amount of names you could have duplicates or misspelled ones

Regards
Example_V1.xlsx
0
 
LVL 29

Accepted Solution

by:
Subodh Tiwari (Neeraj) earned 500 total points
ID: 41742209
Please try this....
In the attached, click the button Extract Data on After sheet to get the desired output.
If you have any issue downloading and opening the workbook due to a temporary bug in the forum right now, please download and save the workbook on your system and then open it.
Otherwise you can just paste the code given below into a New Module of your sample workbook you provided.
Sub MatchAndExtractDetails()
Dim sws As Worksheet, dws As Worksheet
Dim x, y, z()
Dim i As Long, lr As Long, j As Long
Dim dict As Object
Set sws = Sheets("Before")     'Source sheet with Data
Set dws = Sheets("After")        'Output Sheet
Set dict = CreateObject("Scripting.Dictionary")
lr = sws.Cells(Rows.Count, 3).End(xlUp).Row
y = sws.Range("C1:C" & lr).Value
For i = 1 To UBound(y, 1)
    dict.Item(y(i, 1)) = y(i, 1)
Next i
dws.Cells.Clear
x = sws.Range("A1").CurrentRegion.Value
ReDim Preserve z(1 To UBound(x, 1), 1 To 5)
For i = 1 To UBound(x, 1)
    If dict.exists(x(i, 2)) Then
        j = j + 1
        z(j, 1) = x(i, 1)
        z(j, 2) = x(i, 2)
        z(j, 3) = x(i, 4)
        z(j, 4) = x(i, 5)
        z(j, 5) = x(i, 6)
    End If
Next i
dws.Range("A1").Resize(UBound(z, 1), 5).Value = z
MsgBox "Data has been extracted successfully.", vbInformation, "Done!"
End Sub

Open in new window

Example.xlsm
0
 

Author Comment

by:jose11au
ID: 41743554
Thank you so much for your help guys.
0
 
LVL 29

Expert Comment

by:Subodh Tiwari (Neeraj)
ID: 41743638
You're welcome. Glad I could help.
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Improved? Move/Copy Add-in Replacement - How to avoid the annoying, “A formula or sheet you want to move or copy contains the name XXX, which already exists on the destination worksheet.” David Miller (dlmille)  It was one of those days… I wa…
This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question