Solved

Excel - to match employees from multiple lists

Posted on 2016-08-04
4
80 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 52

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 31

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 31

Expert Comment

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

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

This article describes how you can use Custom Document Properties to store settings and other information in your workbook so that they will be available the next time you open the workbook.
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

617 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