VBA to find referenced cell contents and return adjacent cell

Lazerus3511

New Member
Joined
Apr 5, 2015
Messages
15
Greetings and salutations Mr.Excel folks.

First off, thank you all for being here and willing to help. I've used this forum for a great many other deeds in the past. I am not a VBA wizard, but I know my way around excel a fair bit.
Today I got a fun one that I feel jumps into the land of VBA.

The Scenario:
List 1 contains a list of Mac Addresses in column A and the user name in column B.
1660162842135.png

List 2 contains a list of ALL the Mac addresses of the computer, separated by a line break and in a single cell in column A. The Serial number of the Mac in column B.
1660162702628.png


I am finding I am having a very difficult time getting excel to Text to Columns because of the line break, otherwise this would be easy.
My next thought is, is there a way to write a VBA script to search for the Hardware Address in List 1, find that address in List 2 and return the adjacent serial number back to List 1 in column C?
then Loop until it goes through ~4,000 matches?

Figured I would toss this out here and see if any of ya'll wizards have something up your sleeve!
Thanks in advance!
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
In B2 on the 'List1' sheet, try:

=INDEX(Sheet2!B:B,MATCH("*"&A2&"*",Sheet2!A:A,0))

Adjust Sheet2 to the actual sheet name your "List 2" is on, and fill that down column B.
 
Upvote 0
Solution
In B2 on the 'List1' sheet, try:

=INDEX(Sheet2!B:B,MATCH("*"&A2&"*",Sheet2!A:A,0))

Adjust Sheet2 to the actual sheet name your "List 2" is on, and fill that down column B.
@Z51, this worked absolutely flawlessly, I never thought to force a wildcard with & to a whole cell!
This is genuinely appreciated
 
Upvote 0

Forum statistics

Threads
1,214,979
Messages
6,122,557
Members
449,088
Latest member
davidcom

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