Comparing 2 list and get the closest date record for each ID

keongymonopoly

New Member
Joined
Aug 5, 2020
Messages
1
Office Version
  1. 2019
Platform
  1. Windows
Question
I got 2 lists and in list 2, I want to get the value from the result column of list 1 with the following criteria (I've attached the image of the 2 list):
  • based on the Same ID
  • AND Result record's date (list 1) later than the date in list 2
  • AND Result record's date (list 1) nearest to the date in list 2
Expected output
  • In List 2, second row should get the result from second row of List 1
Thanks in advance! Appreciate any help.
 

Attachments

  • excel question.png
    excel question.png
    11.4 KB · Views: 10

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
Welcome to the MrExcel board!

You will generally get a faster answer here if you provide your sample data and expected results with XL2BB to make it easier for helpers by not having to manually type out sample data to test with. :)

See if this is what you want.

20 08 07.xlsm
ABCDEFGH
1IDDatyeResultIDDateResult
213-Aug-19Good11-Aug-19Good
3120-Aug-19Bad115-Aug-19Bad
425-Aug-19Fair127-Aug-19N/A
5213-Aug-19Good21-Aug-19Fair
6327-Aug-19Bad213-Aug-19N/A
7312-Sep-19Fair325-Aug-19Bad
8325-Sep-19Good34-Sep-19Fair
9320-Sep-19Good
10327-Sep-19N/A
Sheet2 (3)
Cell Formulas
RangeFormula
H2:H10H2=IFERROR(INDEX(C$2:C$8,AGGREGATE(15,6,(ROW(C$2:C$8)-ROW(C$2)+1)/((A$2:A$8=F2)*(B$2:B$8=MINIFS(B$2:B$8,A$2:A$8,F2,B$2:B$8,">"&G2))),1)),"N/A")
 
Upvote 0

Forum statistics

Threads
1,215,040
Messages
6,122,806
Members
449,095
Latest member
m_smith_solihull

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