Sort List/Group, if matches value then return a value.

jmcgillis14

New Member
Joined
Sep 24, 2014
Messages
12
[TABLE="width: 500"]
<tbody>[TR]
[TD][/TD]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[/TR]
[TR]
[TD]1
[/TD]
[TD]Name[/TD]
[TD]Number[/TD]
[TD]Name[/TD]
[TD]Number[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]Alex[/TD]
[TD]15
[/TD]
[TD]Sarah[/TD]
[TD]45[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]Eric[/TD]
[TD]20[/TD]
[TD]Steve[/TD]
[TD]33[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]Steve[/TD]
[TD]33[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]Seth[/TD]
[TD]33[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD]Sarah[/TD]
[TD]45[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]7[/TD]
[TD]Erica[/TD]
[TD]50[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

I need to be able to Search Column A, find a Match for column C. Once that Matches, I need to Fill Column D with the same number to the right of the cell that matches. For example, if I type in Sarah in C4, I need D4 to bring me back 45. If I typed Alex into C3, D3 needs to return 15.

Thank you for your help.
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
Unless you've skipped an important criteria, this appears to be a straight-forward VLOOKUP.

Code:
=VLOOKUP(C2,$A$1:$B$7,2,FALSE)

Fill down.
 
Upvote 0
Here is a VBA solution

Code:
Option Explicit


Sub SarahSteve()
    Dim lrA As Long, lrC As Long, i As Long, j As Long
    Application.ScreenUpdating = False
    lrA = Range("A" & Rows.Count).End(xlUp).Row
    lrC = Range("C" & Rows.Count).End(xlUp).Row
    For i = 2 To lrC
        For j = 2 To lrA
            If Range("C" & i) = Range("A" & j) Then
                Range("D" & i) = Range("B" & j)
            End If
        Next j
    Next i
    Application.ScreenUpdating = True
    MsgBox "Completed"
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,214
Messages
6,170,771
Members
452,353
Latest member
strainu

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