vlookup - one to many relationship problem

glorber

New Member
Joined
Aug 3, 2007
Messages
17
Hi,
I have two large excel worksheets (A and B) each containing columns of 'ID' and 'date' and other columns that differ between the files. Each spreadsheet has multiple entries of a given ID and identicle matching dates. I would like to perform a search based on a given ID and date in file A and find the matching ID and date in file B. then extract a third value from B from the appropriate row.
I thought of using vlookup:

if(vlookup(IDInA,RangeInB,colOfDateInB,false)=DateinA,vlookup(...))

The problem is that vlookup stops searching after the first match (ID and Date) between the files. Any way around that?

I Know it sound copmlicated but I hope I managed to explain my problem.
Thanks.
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
If you have identical ID's and Dates then VLookup will not get past the first match. It seems to me that if you have more than one ID-Date combination that you need some other means of matching...first and foremost, if ID-Date combinations are being duplicated what makes one "right" and the other "wrong"? To Excel (and so far to me), they are the same.

Regards.
 
Upvote 0
Hi,
I have two large excel worksheets (A and B) each containing columns of 'ID' and 'date' and other columns that differ between the files. Each spreadsheet has multiple entries of a given ID and identicle matching dates. I would like to perform a search based on a given ID and date in file A and find the matching ID and date in file B. then extract a third value from B from the appropriate row.
I thought of using vlookup:

if(vlookup(IDInA,RangeInB,colOfDateInB,false)=DateinA,vlookup(...))

The problem is that vlookup stops searching after the first match (ID and Date) between the files. Any way around that?

I Know it sound copmlicated but I hope I managed to explain my problem.
Thanks.
aaSmallIfAsLookup glorber.xls
ABCDEFGHIJKL
1IDDateValueOn sheet A
2x-4047/8/20076x-404x-909
3x-4047/8/200777/8/20078/13/2007
4x-7088/1/20072932
5x-9098/13/20070ValueValue
6x-0079/6/2007660
7x-9098/13/200721721
8x-5059/25/20071212 
9x-4047/8/200712  
10
B


K4, copied across:

=SUMPRODUCT(--(B!$A$2:$A$9=K$2),--(B!$B$2:$B$9=K$3))

K6:

Control+shift+enter...

=IF(ROWS(K$6:K6)<=K$4,INDEX(B!$C$2:$C$9,SMALL(IF(B!$A$2:$A$9=K$2,IF(B!$B$2:$B$9=K$3,ROW($A$2:$A$9)-ROW($A$2)+1)),ROWS(K$6:K6))),"")

and copy across and down.
 
Upvote 0
Wow. I appreciate this very much, Aladin. Regards.
 
Upvote 0

Forum statistics

Threads
1,223,697
Messages
6,173,895
Members
452,536
Latest member
Chiz511

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