Find past and nearest date with parameter "X" for a given date

Wojciech

New Member
Joined
May 13, 2018
Messages
27
Office Version
  1. 2021
Platform
  1. Windows
Hi! I would like to find past and nearest date with parameter "X" for a given date. Sorry for my English :).

past_and_nearest_date_with_parameter.png
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
Welcome to the MrExcel board!

An image is not much use to us as we cannot copy the data to test with. You will get many more potential helpers if instead you post a small (copyable) screen shot or two directly in your post. My signature block below has help regarding that.

In relation to your data, are those dates in A2:A7 and A11:A14 actual dates (numbers) or text? If you are unsure, what does this formula return if you enter it in an empty cell?
=ISNUMBER(A2)
 
Upvote 0
are those dates in A2:A7 and A11:A14 actual dates (numbers) or text?
Assuming they are actual dates, try this in B11, copied down.

Excel Workbook
AB
22017-11-01X
32017-12-10Y
42018-05-01X
52018-05-01Y
62018-05-10X
72018-05-10Y
8
9
10
112015-01-01 
122017-12-102017-11-01
132018-05-052018-05-01
142018-05-132018-05-10
Nearest Past Date
 
Last edited:
Upvote 0
They are actual dates, thanks! :) Ok, next time I will put the data to test with, just like you in the last post.
 
Upvote 0
Yes, this formula was exactly what I needed. A very transparent formula. Thank you.
 
Upvote 0
Yes, this formula was exactly what I needed. A very transparent formula. Thank you.
OK, thanks for the confirmation. :)

I would still stick with that formula but if you happen to have Excel through Office 365 then you could also use the MAXIFS function, though in this case it has to be coerced a bit.

Excel Workbook
AB
22017-11-01X
32017-12-10Y
42018-05-01X
52018-05-01Y
62018-05-10X
72018-05-10Y
8
9
10
112015-01-01 
122017-12-102017-11-01
132018-05-052018-05-01
142018-05-132018-05-10
Nearest Past Date (2)



.. or yet another option (still for Office 365) would be to use the much simpler
=MAXIFS(A$2:A$7,A$2:A$7,"<"&A11,B$2:B$7,"X")
and use Conditional formatting to hide any 0 (displayed as 1900-01-00) values.
 
Upvote 0
Due to internal requirements in my work, I do not have access to office 365, but I will note this solution for the future. Thank you. :)
 
Upvote 0

Forum statistics

Threads
1,223,897
Messages
6,175,269
Members
452,628
Latest member
dd2

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