Find Last Date and Next Date

dcunningham

Board Regular
Joined
Jul 14, 2015
Messages
58
Hi Everyone,

I have a list of asset IDs and service dates. I'd like to find the last service date and the next service date for a specific asset. The way I tried it was to use a formula like this:

Code:
{=IF(MIN(IF(Lists!$J$11:$J$31 = 'Action Overview'!A2,Lists!$K$11:$K$31))=0,NA(), MIN(IF(Lists!$J$11:$J$31 = 'Action Overview'!A2,Lists!$K$11:$K$31)))}

This would be to find the last service date, and I'd use 'MAX' in place of 'MIN' for the next service date. The problem is that my list contains dates before the last service date and after the next service date, so I wind up with dates far in the past and far into the future. I think the way to fix this would to be to use =TODAY() to get the current date, and use logic that says "maximum date for this asset less than or equal to current date" for the last service date and "minimum date for this asset greater than or equal to current date". I just don't have the familiarity with Excel's functions to make this work.

Any help you can provide with this would be greatly appreciated.

Thanks,

Dan
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
Something like this?
These are array formulas and must be entered with CTRL-SHIFT-ENTER.
Excel Workbook
ABCDEF
1IDDateIDDate
2ID14/3/2016ID112/20/2016Last Service
3ID23/18/20164/14/2017Next Service
4ID35/9/2016
5ID17/30/2016
6ID112/9/2017
7ID63/5/2017
8ID31/24/2017
9ID81/1/2016
10ID14/14/2017
11ID34/15/2017
12ID68/17/2016
13ID15/24/2016
14ID31/31/2016
15ID143/28/2017
16ID112/20/2016
17ID61/8/2017
18ID34/29/2017
19ID62/5/2016
Sheet
 
Upvote 0

Forum statistics

Threads
1,215,938
Messages
6,127,777
Members
449,406
Latest member
Pavesib

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