vlookup with multiple rows returned?

Danny54

Active Member
Joined
Jul 3, 2019
Messages
295
Office Version
  1. 365
Platform
  1. Windows
is there a way to return multiple lookup rows when searching for values from one workbook to another?

i have the following in the first workbook and its the values to be return from the next sheet base on IP
IP 10.10.10.4 is found three times (this is workbook A)


abc
clientnameip
mdcar10.10.10.1
mdboat10.10.10.2
mdtractor10.10.10.3
mdtractor10.10.10.4
wdwindow192.168.1.1
wdwindow192.168.1.2
wdwindow192.168.1.3
wdwindow10.10.10.4
ggindoor192.168.10.1
gginwindow192.168.10.2
ggintile192.168.10.3
gginvent192.168.10.4


This is my functional interpretation of what I think would be the resolution of returning the system name ("A") when matching ("B") between book. (this is Workbook B)

systemipdateverclient
a10.10.10.4
1/1/2020​
1​
vlookup?
a192.168.20.1
1/2/2020​
1​
vlookup?
b10.10.10.4
1/3/2020​
2​
vlookup?
b192.168.30.1
1/4/2020​
2​
vlookup?
c192.168.30.2
1/5/2020​
3​
vlookup?
c10.10.20.1
1/6/2020​
3​
vlookup?
d10.10.20.2
1/7/2020​
4​
vlookup?
d10.10.10.4
1/8/2020​
4​
vlookup?
d10.20.31.1
1/9/2020​
4​
vlookup?


after the vlookup runs Workbook B would look like this.
it seams the vlookup function always return the first value found in the lookup. I need this and the others as well.

If someone could steer me, i would be grateful.

Thanks


abcde
systemipdatevervalue returned
a10.10.10.4
1/1/2020​
1​
md
a10.10.10.4
1/1/2020​
1​
wd
b10.10.10.4
1/1/2020​
1​
md
b10.10.10.4
1/1/2020​
1​
wd
d10.10.10.4
1/1/2020​
1​
md
d10.10.10.4
1/1/2020​
1​
wd
a192.168.20.1
1/2/2020​
1​
notfound
b192.168.30.1
1/4/2020​
2​
notfound
c192.168.30.2
1/5/2020​
3​
notfound
c10.10.20.1
1/6/2020​
3​
notfound
d10.10.20.2
1/7/2020​
4​
notfound
d10.20.31.1
1/9/2020​
4​
notfound
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
Maybe something like this.
You will need Excel ver 2010 or later with the AGGREGATE function.
Blanks in the example below is where there wasn't a match for the IP.

Sheet 2
Book1
ABCDE
1systemipdateverclient
2a10.10.10.41/1/20201md
3a192.168.20.11/2/20201 
4b10.10.10.41/3/20202wd
5b192.168.30.11/4/20202 
6c192.168.30.21/5/20203 
7c10.10.20.11/6/20203 
8d10.10.20.21/7/20204 
9d10.10.10.41/8/20204 
10d10.20.31.11/9/20204 
Sheet2
Cell Formulas
RangeFormula
E2:E10E2=IFERROR(INDEX(Sheet1!$A$2:$A$13,AGGREGATE(15,6,(ROW(Sheet1!$C$2:$C$13)-ROW(Sheet1!$C$2)+1)/(B2=Sheet1!$C$2:$C$13),COUNTIF($B$2:B2,B2))),"")


Sheet 1
Book1
ABC
1clientnameip
2mdcar10.10.10.1
3mdboat10.10.10.2
4mdtractor10.10.10.3
5mdtractor10.10.10.4
6wdwindow192.168.1.1
7wdwindow192.168.1.2
8wdwindow192.168.1.3
9wdwindow10.10.10.4
10ggindoor192.168.10.1
11gginwindow192.168.10.2
12ggintile192.168.10.3
13gginvent192.168.10.4
Sheet1
 
Upvote 0

Forum statistics

Threads
1,224,820
Messages
6,181,155
Members
453,021
Latest member
Justyna P

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