Select the closest date

jarrholm

New Member
Joined
Oct 13, 2022
Messages
1
Office Version
  1. 2013
Platform
  1. Windows
I am trying to search for the closest date value within a table with a couple of other conditionals. The logic is as follows:

  1. If Type = I
  2. Then Search the rest of the Number column for exact matching numbers
  3. Only look at Type = O
  4. Select the date that is closest (selected date should also be greater than what's in column C) as the end result

Below is what I was attempting and what I'm getting. It seems as though the pattern of the result is correct but something in the formula is not quite right. The result that I want is in column F. Any assistance would be much appreciated! I'm not even sure using the match function is the best option here.

One additional note. I tried converting column D to a short date and that gives the wrong dates.

1665687408748.png
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Welcome to the board!

Your profile says you're using Office 2013. If that happens to be outdated and you're on 2019 or Office 365, you can use the new MINIFS function such as:

D2
Code:
=IF(B2="I",MINIFS($C$2:$C$13,$B$2:$B$13,"O",$C$2:$C$13,">"&C2),"FALSE")

Otherwise, if you are indeed using 2013 and don't have access to MINIFS, you can use this array formula... but note that it must be confirmed with CTRL+SHIFT+ENTER instead of just ENTER (doing so correctly will result in Excel putting { }s around your formula in the formula bar):

D2
Code:
=IF(B2="I",MIN(IF($B$2:$B$13="O",IF($C$2:$C$13>C2,$C$2:$C$13))),FALSE)
 
Upvote 0

Forum statistics

Threads
1,214,839
Messages
6,121,891
Members
449,058
Latest member
Guy Boot

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