Return the higgest and lowest date

JOHN007

New Member
Joined
Aug 7, 2014
Messages
38
I need help to look for nearest date (Min, Max) available in sheet2 for the given date sheet1 and applicable variable(Apple). (similar to lookup but in this case exat date doesn't match).



Sheet1
A
B
RESULT()
Expected Result
1
Name
DATE
Nearest min date
Nearest max date
expectedmin date to be returned
expected date to be returned
2
Apple
01-01-2018
?
?
02-01-2018
NA
3
Apple
03-01-2018
?
?
03-01-2018
03-01-2018
4
Orange
08-01-2018
?
?
NA
09-01-2018
5
banana
11-01-2018
?
?
10-01-2018
12-01-2018
Sheet 2
A
B
Name
Date
1
Apple
02-01-2018
2
Apple
03-01-2018
3
Orange
07-01-2018
4
Orange
09-01-2018
5
Orange
10-01-2018
6
Banana
10-01-2018
7
Banana
12-01-2018
8
Banana
13-01-2018

<tbody>
</tbody>
 
Last edited:

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Since dates are doubles you can subtract dates from sheet 1 with dates from sheet 2 and find the smallest / highest difference
 
Last edited by a moderator:
Upvote 0

Forum statistics

Threads
1,214,429
Messages
6,119,433
Members
448,897
Latest member
ksjohnson1970

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