Find matching names from two columns and return corresponding value

rimshot609

Board Regular
Joined
Jun 4, 2015
Messages
79
Column A: I have a list of names from a database.

Column B: I have usernames that correspond with the names from column A.

Column C: I have a list of names from the HR department.

Column D: I have a list of phone numbers that correspond with column C names.

How can I lookup the name from column A and match it with the same name from column C to make a table that contains Usernames, Names, and Phone Numbers?
I should mention that there are more names in the database than the HR names column so creating a table and sorting alphabetically will not work.
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
rimshot609,

If you prefer a vba approach, you might consider the following...

Code:
Sub MatchNames_1025973()
Dim arr1 As Variant, arr2() As Variant
Dim i As Long, j As Long, n As Long
arr1 = Range("A2:D" & Cells(Rows.Count, "A").End(xlUp).Row)
For i = 1 To UBound(arr1, 1)
    For j = 1 To UBound(arr1, 1)
        If arr1(i, 1) = arr1(j, 3) Then
            n = n + 1
            ReDim Preserve arr2(1 To 3, 1 To n)
            arr2(1, n) = arr1(j, 3)
            arr2(2, n) = arr1(j, 2)
            arr2(3, n) = arr1(j, 4)
        End If
    Next j
Next i
Range("F2:H" & n + 1).Value = WorksheetFunction.Transpose(arr2)
End Sub

It's assumed that Row1 is a header row. The resulting table will be placed in Columns F:H.

Cheers,

tonyyy
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,334
Members
452,636
Latest member
laura12345

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
Back
Top