Reference ID, Then Return Nearest Date from Second Reference

husar

New Member
Joined
Sep 27, 2016
Messages
6
Hello Excel Community,

The Data:
(A)
ID
(B)
Test Date
(C)
Test Value
(D)(E)
Reference ID
(F)
Reference Date
(G)
Return Value
10DD/MM/901
10DD/MM/06.60
10DD/MM/05.60
11DD/MM/15
10DD/MM/14.90
12DD/MM/08
11DD/MM/89.88
13DD/MM/14
11DD/MM/06.90
14DD/MM/16
11DD/MM/15.88
15DD/MM/90

<tbody>
</tbody>









The Question:
I would like to place a formula in column G. The formula's purpose would be to reference columns E and F and then return the Test Value (C) from the same ID in column A with the closest Test Date to the Reference Date.

For example - Pull the test value for ID 10 that is associated with DD/MM/05, because that is the date closest to the reference date for ID 10 in columns E and F. The return value would be .60.

What I have tried:
Various combinations of INDEX and MATCH together in array formulas. The closest I can get it to do is return the first Test Value from the three available with ID 10. Or, it will return the date in column B closest to column F regardless of the ID the dates are attached to.

Note:
I would eventually like to pull the formula down the row of G so that I can return the appropriate values for all IDs in column E.

Any help would be appreciated. Thank you so much!
Robyn
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
Does the attached work if posted in G1?

Code:
=INDEX(A$1:F$20,MATCH(1,(A$1:A$20=E1)*(INDEX(B$1:B$20,MATCH(MIN(ABS(B$1:B$20-F1)),ABS(B$1:B$20-F1),0))),-1),3)
 
Last edited:
Upvote 0
Unfortunately, the formula did not work for me. It returned an incorrect value (.90 vs the correct .60). And, when I dragged it down one cell, it returned "N/A".

Is there another formula that may work? Did it work for you?
 
Upvote 0

Forum statistics

Threads
1,214,599
Messages
6,120,447
Members
448,966
Latest member
DannyC96

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