closest next closest time using Index Match Min ABS functions only

arbabchin

New Member
Joined
Nov 16, 2021
Messages
3
Office Version
  1. 2016
Hello Everyone

I am trying to return a time at destination in Cell F5 using the following function, but since the absolute difference of Cell D5 and L6 is greater than with that of L7 it returns 18:30:36, which is not intended, required value is in cell L7

=INDEX(L4:L8,MATCH(MIN(ABS(L4:L8-D5)),ABS(L4:L8-D5),0))

i would like to keep using index match CSE for this particular report.



test.xlsx
BCDEFGHIJKLMN
1
2Master Data
3Vehicle No.Reporting Actual DestinationDirection
4Vehicle No.Schedule TimeActual DepartureActual Destination TimeDest-DepB0032In14:39:28Forward
5B003119:10:0019:10:2418:30:36#######B0031In16:22:28Forward
6B0031In18:30:36Forward
7B0031In19:50:21Forward
8B0037In21:27:46Forward
9
10
11
Sheet2
Cell Formulas
RangeFormula
F5F5=INDEX(L4:L8,MATCH(MIN(ABS(L4:L8-D5)),ABS(L4:L8-D5),0))
G5G5=F5-E5
Press CTRL+SHIFT+ENTER to enter array formulas.
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Why should it return L7? L6-D5 is the minimum difference.
 
Upvote 0
Why should it return L7? L6-D5 is the minimum difference.
yes it is certainly, the reason i want L7 is because this data is for calulating Journey time of a vehicle and a vehicle can not reach its destination before its departure, F5 should be a greater than E5.
 
Upvote 0
Ok, how about
Excel Formula:
=AGGREGATE(15,6,L4:L8/(J4:J8=C5)/(L4:L8>=D5),1)
 
Upvote 0
Solution

Forum statistics

Threads
1,223,157
Messages
6,170,419
Members
452,325
Latest member
BlahQz

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