Index Match on an exact Number and a Date within a Range

blakefraley

New Member
Joined
Oct 6, 2017
Messages
1
Hey everyone,

I'm trying to perform data analysis and need to pull in a contract number based on an ID field and determine which record to pull for that ID based on where the Prod Date falls within the From/To Date Ranges (which are each a different column). My data has a unique record per ID and Date but I need to pull in a contract number for hundreds of thousands of records. I've tried using Index/Match with a match type of 1 but am not getting the expected results. The formula I tried was this:

{=INDEX('Detail'!$D$1:$D$1500,MATCH(A2&B2,Detail'!$A$1:$A$1500&Detail'!$B$1:$B$1500,1))}

Expected Results for Contract # (note that this is a subset of the 800,000 records I have)
'Results' Tab:
ID Prod Date Contract #
580678A 8/1/2016 1
580678A 1/1/2017 2
580678A 12/31/2016 1
580678A 4/1/2017 2
123A 8/1/2016 3
123B 1/1/2017 4

'Detail' Data tab:
ID From Date To Date Contract #
580678A 1/1/2016 12/31/2016 1
580678A 1/1/2017 12/31/2017 2
123A 1/1/2016 12/31/2016 3
123B 1/1/2017 12/31/2017 4

Any suggestions and help would be greatly appreciated.
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
=SUMPRODUCT((A2=Detail'!$A$1:$A$1500)*(B2>=Detail'!$B$1:$B$1500)*(B2<=Detail'!$C$1:$C$1500),'Detail'!$D$1:$D$1500)
 
Upvote 0
Another option might be to use a helper column to ID those rows that meet your dates, and base the I/M on that?
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,286
Members
452,631
Latest member
a_potato

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