vlookup with match to return a result with multiple rows with lookup value

excelnoob_67

New Member
Joined
Jul 8, 2022
Messages
21
Office Version
  1. 365
Platform
  1. Windows
So I have a doozy of a question.

I have 2 tables.
Table 1: contains a list "Sites=siteID" on each row. Columns contain "Device Name" 1-30
Table 2: contains "SiteID", "Device Name" SiteID is over multiple rows

See examples
Table 1:
Site IDDevice Name 001Device Name 002Device Name 003
7412LAP7412001LAP7412002LAP7412003
9632LAP9632001LAP9632002LAP9632003

Table 2:
7412LAP7412001
7412LAP7412002
7412LAP7412003
9632LAP9632001
9632LAP9632002
9632LAP9632003

Now what I would like to do is match / vlookup the data in table 2 and update table 1 column Device Name.
In my head it would be something like:
lookup 7412 if device name = 7412001 add it column 001
lookup 7412 if device name = 7412002 add it column 002
And so on and so on.

first issue is vlookup wont look past the first siteID on table 2. Table is not a large export and can be formatting another way to make is easier to look up.
I guess the real question is how can I tell excel if the siteid matches and the device id ends in 001/2/3 add to the relevant columns

This isn't a simple transpose will fix situation :)

Any help would be appreciate

Thanks
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Hi, how about something like this:

Book1
ABCD
1Site IDDevice Name 001Device Name 002Device Name 003
27412LAP7412001LAP7412002LAP7412003
39632LAP9632001LAP9632002LAP9632003
49999LAP9632001LAP9632002
5
6Table 2:
77412LAP7412001
87412LAP7412002
97412LAP7412003
109632LAP9632001
119632LAP9632002
129632LAP9632003
139999LAP9632002
149999LAP9632001
Sheet1
Cell Formulas
RangeFormula
B4:C4,B2:D3B2=TRANSPOSE(SORT(FILTER($B$7:$B$14,$A$7:$A$14=A2)))
Dynamic array formulas.
 
Upvote 0
Hi, how about something like this:

Book1
ABCD
1Site IDDevice Name 001Device Name 002Device Name 003
27412LAP7412001LAP7412002LAP7412003
39632LAP9632001LAP9632002LAP9632003
49999LAP9632001LAP9632002
5
6Table 2:
77412LAP7412001
87412LAP7412002
97412LAP7412003
109632LAP9632001
119632LAP9632002
129632LAP9632003
139999LAP9632002
149999LAP9632001
Sheet1
Cell Formulas
RangeFormula
B4:C4,B2:D3B2=TRANSPOSE(SORT(FILTER($B$7:$B$14,$A$7:$A$14=A2)))
Dynamic array formulas.
Hi FormR

Really close!
Thats returns the correct result and in numerical order but doesnt match up with my headers. It also automatically spills over in to the next cells

See screenshot
ignore row 2 I was seeing if I could match it as an unique ID

1657266549465.png
 

Attachments

  • 1657266461594.png
    1657266461594.png
    20.7 KB · Views: 10
Upvote 0
Hi, can you repost the new sample data and layout using same method you did in the first post - so we can copy and paste it to Excel, rather than re-type it.
I'm just walking out of the door of the office ill post it once I get home. Thanks.
 
Upvote 0
(y)

You could also consider exploring XL2BB as way to show your sample data and layout.

 
Upvote 0
This is the full data set below.
Hopefully this makes some more sense

TIA

Table 1:

Store IDTablet DNS Name TW101OS Upgrade StatusTablet DNS Name TW102OS Upgrade StatusTablet DNS Name TW103OS Upgrade StatusTablet DNS Name TW104OS Upgrade StatusTablet DNS Name TW105OS Upgrade StatusTablet DNS Name TW106
TW101TW102TW103TW104TW105TW106
7841
0545
7762
0613
5804
7705
7703
0667
0585
0654
0523
0506
0630

Table 2:
Store IDSystem Name
0506SV0506TW102
0523SV0523TW101
0523SV0523TW102
0523SV0523TW103
0523SV0523TW104
0523SV0523TW105
0523SV0523TW106
0523SV0523TW107
0523SV0523TW108
0523SV0523TW109
0545SV0545TW102
0545SV0545TW103
0545SV0545TW104
0545SV0545TW105
0545SV0545TW106
0545SV0545TW107
0585SV0585TW102
0585SV0585TW103
0585SV0585TW104
0585SV0585TW105
0585SV0585TW106
0585SV0585TW107
0613SV0613TW101
0613SV0613TW102
0613SV0613TW104
0613SV0613TW105
0630SV0630TW101
0630SV0630TW102
0630SV0630TW103
0630SV0630TW104
0630SV0630TW105
0654SV0654TW101
0654SV0654TW102
0654SV0654TW103
0654SV0654TW104
0654SV0654TW105
0654SV0654TW106
0654SV0654TW107
0667SV0667TW101
0667SV0667TW102
0667SV0667TW103
5804SV5804TW101
5804SV5804TW102
5804SV5804TW103
5804SV5804TW104
5804SV5804TW105
5804SV5804TW107
5804SV5804TW108
5804SV5804TW109
5804SV5804TW110
7703SV7703TW102
7703SV7703TW103
7703SV7703TW105
7703SV7703TW166
7703SV7703TW167
7703SV7703TW168
7703SV7703TW169
7705SV7705TW101
7705SV7705TW102
7705SV7705TW103
7705SV7705TW104
7762SV7762TW101
7762SV7762TW103
7762SV7762TW104
7762SV7762TW105
7841SV7841TW101
7841SV7841TW103
7841SV7841TW104
7841SV7841TW110
7841SV7841TW111
7841SV7841TW114
7841SV7841TW115
7841SV7841TW116
 
Upvote 0
Hi, if I've understood correctly, you could try this copied down and across.

Book3
ABCDEFGHIJKL
1Store IDTablet DNS Name TW101OS Upgrade StatusTablet DNS Name TW102OS Upgrade StatusTablet DNS Name TW103OS Upgrade StatusTablet DNS Name TW104OS Upgrade StatusTablet DNS Name TW105OS Upgrade StatusTablet DNS Name TW106
2TW101TW102TW103TW104TW105TW106
37841SV7841TW101   SV7841TW103 SV7841TW104    
4545  SV0545TW102 SV0545TW103 SV0545TW104 SV0545TW105 SV0545TW106
57762SV7762TW101   SV7762TW103 SV7762TW104 SV7762TW105  
6613SV0613TW101 SV0613TW102   SV0613TW104 SV0613TW105  
75804SV5804TW101 SV5804TW102 SV5804TW103 SV5804TW104 SV5804TW105  
87705SV7705TW101 SV7705TW102 SV7705TW103 SV7705TW104    
97703  SV7703TW102 SV7703TW103   SV7703TW105  
10667SV0667TW101 SV0667TW102 SV0667TW103      
11585  SV0585TW102 SV0585TW103 SV0585TW104 SV0585TW105 SV0585TW106
12654SV0654TW101 SV0654TW102 SV0654TW103 SV0654TW104 SV0654TW105 SV0654TW106
13523SV0523TW101 SV0523TW102 SV0523TW103 SV0523TW104 SV0523TW105 SV0523TW106
14506  SV0506TW102        
15630SV0630TW101 SV0630TW102 SV0630TW103 SV0630TW104 SV0630TW105  
16
17Table 2:
18Store IDSystem Name
19506SV0506TW102
20523SV0523TW101
21523SV0523TW102
22523SV0523TW103
23523SV0523TW104
24523SV0523TW105
25523SV0523TW106
26523SV0523TW107
27523SV0523TW108
28523SV0523TW109
29545SV0545TW102
30545SV0545TW103
31545SV0545TW104
32545SV0545TW105
33545SV0545TW106
34545SV0545TW107
35585SV0585TW102
36585SV0585TW103
37585SV0585TW104
38585SV0585TW105
39585SV0585TW106
40585SV0585TW107
41613SV0613TW101
42613SV0613TW102
43613SV0613TW104
44613SV0613TW105
45630SV0630TW101
46630SV0630TW102
47630SV0630TW103
48630SV0630TW104
49630SV0630TW105
50654SV0654TW101
51654SV0654TW102
52654SV0654TW103
53654SV0654TW104
54654SV0654TW105
55654SV0654TW106
56654SV0654TW107
57667SV0667TW101
58667SV0667TW102
59667SV0667TW103
605804SV5804TW101
615804SV5804TW102
625804SV5804TW103
635804SV5804TW104
645804SV5804TW105
655804SV5804TW107
665804SV5804TW108
675804SV5804TW109
685804SV5804TW110
697703SV7703TW102
707703SV7703TW103
717703SV7703TW105
727703SV7703TW166
737703SV7703TW167
747703SV7703TW168
757703SV7703TW169
767705SV7705TW101
777705SV7705TW102
787705SV7705TW103
797705SV7705TW104
807762SV7762TW101
817762SV7762TW103
827762SV7762TW104
837762SV7762TW105
847841SV7841TW101
857841SV7841TW103
867841SV7841TW104
877841SV7841TW110
887841SV7841TW111
897841SV7841TW114
907841SV7841TW115
917841SV7841TW116
Sheet1
Cell Formulas
RangeFormula
B3:L15B3=IF(B$2="","",INDEX(FILTER($B$19:$B$91,($A$19:$A$91=$A3)*(RIGHT($B$19:$B$91,LEN(B$2))=B$2),""),1))
 
Upvote 0
Solution
Hi, if I've understood correctly, you could try this copied down and across.

Book3
ABCDEFGHIJKL
1Store IDTablet DNS Name TW101OS Upgrade StatusTablet DNS Name TW102OS Upgrade StatusTablet DNS Name TW103OS Upgrade StatusTablet DNS Name TW104OS Upgrade StatusTablet DNS Name TW105OS Upgrade StatusTablet DNS Name TW106
2TW101TW102TW103TW104TW105TW106
37841SV7841TW101   SV7841TW103 SV7841TW104    
4545  SV0545TW102 SV0545TW103 SV0545TW104 SV0545TW105 SV0545TW106
57762SV7762TW101   SV7762TW103 SV7762TW104 SV7762TW105  
6613SV0613TW101 SV0613TW102   SV0613TW104 SV0613TW105  
75804SV5804TW101 SV5804TW102 SV5804TW103 SV5804TW104 SV5804TW105  
87705SV7705TW101 SV7705TW102 SV7705TW103 SV7705TW104    
97703  SV7703TW102 SV7703TW103   SV7703TW105  
10667SV0667TW101 SV0667TW102 SV0667TW103      
11585  SV0585TW102 SV0585TW103 SV0585TW104 SV0585TW105 SV0585TW106
12654SV0654TW101 SV0654TW102 SV0654TW103 SV0654TW104 SV0654TW105 SV0654TW106
13523SV0523TW101 SV0523TW102 SV0523TW103 SV0523TW104 SV0523TW105 SV0523TW106
14506  SV0506TW102        
15630SV0630TW101 SV0630TW102 SV0630TW103 SV0630TW104 SV0630TW105  
16
17Table 2:
18Store IDSystem Name
19506SV0506TW102
20523SV0523TW101
21523SV0523TW102
22523SV0523TW103
23523SV0523TW104
24523SV0523TW105
25523SV0523TW106
26523SV0523TW107
27523SV0523TW108
28523SV0523TW109
29545SV0545TW102
30545SV0545TW103
31545SV0545TW104
32545SV0545TW105
33545SV0545TW106
34545SV0545TW107
35585SV0585TW102
36585SV0585TW103
37585SV0585TW104
38585SV0585TW105
39585SV0585TW106
40585SV0585TW107
41613SV0613TW101
42613SV0613TW102
43613SV0613TW104
44613SV0613TW105
45630SV0630TW101
46630SV0630TW102
47630SV0630TW103
48630SV0630TW104
49630SV0630TW105
50654SV0654TW101
51654SV0654TW102
52654SV0654TW103
53654SV0654TW104
54654SV0654TW105
55654SV0654TW106
56654SV0654TW107
57667SV0667TW101
58667SV0667TW102
59667SV0667TW103
605804SV5804TW101
615804SV5804TW102
625804SV5804TW103
635804SV5804TW104
645804SV5804TW105
655804SV5804TW107
665804SV5804TW108
675804SV5804TW109
685804SV5804TW110
697703SV7703TW102
707703SV7703TW103
717703SV7703TW105
727703SV7703TW166
737703SV7703TW167
747703SV7703TW168
757703SV7703TW169
767705SV7705TW101
777705SV7705TW102
787705SV7705TW103
797705SV7705TW104
807762SV7762TW101
817762SV7762TW103
827762SV7762TW104
837762SV7762TW105
847841SV7841TW101
857841SV7841TW103
867841SV7841TW104
877841SV7841TW110
887841SV7841TW111
897841SV7841TW114
907841SV7841TW115
917841SV7841TW116
Sheet1
Cell Formulas
RangeFormula
B3:L15B3=IF(B$2="","",INDEX(FILTER($B$19:$B$91,($A$19:$A$91=$A3)*(RIGHT($B$19:$B$91,LEN(B$2))=B$2),""),1))

Worked great Thanks!

final formula below for my specific sheet
=IF(H$2="","",INDEX(FILTER('[Copy of Book1.xlsx]Sheet1'!$B$2:$B$74,('[Copy of Book1.xlsx]Sheet1'!$A$2:$A$74=$A3)*(RIGHT('[Copy of Book1.xlsx]Sheet1'!$B$2:$B$74,LEN(H$2))=H$2),""),1))
 
Upvote 0
@FormR as my excel start to go the processing time for al the formulas is becoming really slow. can we adjust the formula to lookup the first say 1200 rows opposed to the entire column?
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

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