VBA - to Lookup a value in different worksheet - Then return all matches

CF64

New Member
Joined
Feb 17, 2021
Messages
48
Office Version
  1. 365
Platform
  1. Windows
Hello,
I have 2 worksheets - Devices and Departments

worksheet Devices has a list of Device IDs in Column A
worksheet Department has a list of department names in column A and a comma-delimited list of device IDs associated with that department (123xyz, 126xyz, 127xyz, 128xyz) in column B


Is there a way to look up the device ID from the Devices worksheet column A in the Department worksheets column B and return all departments separated by a comma, associated with that device ID into adjacent cells in column B of the Devices worksheet?


Devices Worksheet
DeviceIDs (column A)Departments Found In (column B)
123xyzBlue, Red, Yellow
124xyzRed, Yellow
125xyzYellow

Department Worksheet
Department Name (column A)DeviceIDs (column B)
Blue123xyz, 126xyz, 127xyz, 128xyz
Red123xyz, 124xyz, 129xyz
Yellow123xyz, 124xyz, 125xyz, 130xyz
 
Thank you to all who replied. I cleared out all of the #N/As and I was able to get it to work successfully.
 
Upvote 0

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.

Forum statistics

Threads
1,215,332
Messages
6,124,314
Members
449,153
Latest member
JazzSingerNL

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