Calculate latest date from two columns

thisisliam

New Member
Joined
Oct 8, 2020
Messages
7
Office Version
  1. 2019
Platform
  1. MacOS
Hi all

I need to calculate the latest date of two columns and add two years to that date.

Column B contains the date (B8:B250 to exclude headers). Columns AD (AD8:AD250) and AF (AF8:AF250) are cells which are used to define what specific event, if any, was logged on that date, denoted by a simple "X" value entered by the user. I need to calculate the latest date, if any, defined by an "X" value in either columns AD or AF and add two years.

For example, this spreadsheet is a pilot logbook. Column AD is where the user would indicate if that entry was a Checkride in the logbook, AF is where the user would indicate if that entry was a Flight Review in the logbook. A Flight Review is required two years after the last logged Flight Review OR after the last Checkride. If the pilot has a Checkride within that time then that resets the two year date as a Checkride can be considered a Flight Review but a Flight Review cannot be considered a Checkride.

The formula needs to calculate the date of the next Flight Review.

Any help greatly appreciated!
 

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.
Hi @Dave87 - I've attached a screenshot of a demo spreadsheet. I'm looking for a formula that will reference columns B, AD and AF as indicated in the first post.
 

Attachments

  • Screen Shot 2020-10-08 at 11.05.57 PM.png
    Screen Shot 2020-10-08 at 11.05.57 PM.png
    240.5 KB · Views: 51
Upvote 0
Hi & welcome to MrExcel.
Assuming the Dates in col B are always in order (oldest to newest) try
Excel Formula:
=LOOKUP(2,1/(((AD8:AD250="X")+(AF8:AF250="X"))>0),B8:B250)
 
Upvote 0
Try this

=INDEX($B$8:$B$250,AGGREGATE(14,6,ROW($AD$8:$AD$250)/(($AD$8:$AD$250="X")+($AF$8:$AF$250="X")),1)-ROW($B$8)+1)
 
Upvote 0
@kvsrinivasamurthy
If there are two Xs on the same row, then your formula will give an error, or an incorrect value.
 
Upvote 0
Try this,it works.

=INDEX($B$8:$B$250,AGGREGATE(14,6,ROW($AD$8:$AD$250)/((($AD$8:$AD$250="X")+($AF$8:$AF$250="X"))>0),1)-ROW($B$8)+1)
 
Upvote 0
Hi guys

Hi & welcome to MrExcel.
Assuming the Dates in col B are always in order (oldest to newest) try
Excel Formula:
=LOOKUP(2,1/(((AD8:AD250="X")+(AF8:AF250="X"))>0),B8:B250)

Try this,it works.

=INDEX($B$8:$B$250,AGGREGATE(14,6,ROW($AD$8:$AD$250)/((($AD$8:$AD$250="X")+($AF$8:$AF$250="X"))>0),1)-ROW($B$8)+1)


Both formulas give the correct most recent date. And no, unless I'm sorting for a particular reason all dates are in order and the filter is always reset. In terms of adding 24 months to the final date is it best to just add 730 days to the end of the formula?
 
Upvote 0
Missed that bit, how about
Excel Formula:
=EDATE(LOOKUP(2,1/(((AD8:AD250="X")+(AF8:AF250="X"))>0),B8:B250),24)
 
Upvote 0

Forum statistics

Threads
1,214,982
Messages
6,122,575
Members
449,089
Latest member
Motoracer88

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