Reputation: 1
I have an Spreadsheet with values listed multiple times in multiple columns. Example column b
thru d
. Is it possible to lookup each of these values individually and return the values from Column A
.
Data Table
Output Example
The output Sheet would already have the values to look up listed in Column A
.
Upvotes: 0
Views: 461
Reputation: 440
this is vba solution, I did not declare variables, please do it
Sub a()
Set sh1 = Sheets(1)
Set sh2 = Sheets(2)
Lastrow2 = sh2.Cells(Rows.Count, "A").End(xlUp).Row
For r = 2 To Lastrow2
cable = sh2.Cells(r, 1)
s = ""
For Each cell In sh1.UsedRange
If cell = cable Then s = s + sh1.Cells(cell.Row, 1) + ","
Next
sh2.Cells(r, 2) = s
Next
End Sub
Upvotes: 1