I have three columns of dates. Each row corresponds to one item. I want to find the closest future date to today. So I used this
=MIN(IF(G23:I23>$E$1,G23:I23)). However, for two items, the dates are all less than TODAY(). For that I would like to find the furthest past date from TODAY() that is not 01-01-00. I would like a formula that I could drag down for all items, despite having future of past dates. I need this because my dates correspond to data from a web query, so the dates may change from past to future depending on the dates on the website. I tried using the formula below (I know I used MAX because I didn't know how to exclude 01-01-00), but it gives a #VALUE error sometimes, and sometimes it doesn't.
IF(MIN(IF(G27:I27>$E$1,G27:I27))=TRUE,MIN(IF(G27:I27>$E$1,G27:I27)),(DATE(YEAR(MAX(IF(G27:I27<$E$1,G27:I27)))+2,MONTH(MAX(IF(G27:I27<$E$1,G27:I27)))+6,DAY(MAX(IF(G27:I27<$E$1,G27:I27))))))
If anyone could help me figure this out, I would greatly appreciate it. I have tried reading about arrays but it hasn't gotten me anywhere
.
The first picture shows the values when the first formula is used for all rows. The second picture shows the value error when only that row uses the latter formula.
[/URL][/IMG]
[/URL][/IMG]
=MIN(IF(G23:I23>$E$1,G23:I23)). However, for two items, the dates are all less than TODAY(). For that I would like to find the furthest past date from TODAY() that is not 01-01-00. I would like a formula that I could drag down for all items, despite having future of past dates. I need this because my dates correspond to data from a web query, so the dates may change from past to future depending on the dates on the website. I tried using the formula below (I know I used MAX because I didn't know how to exclude 01-01-00), but it gives a #VALUE error sometimes, and sometimes it doesn't.
IF(MIN(IF(G27:I27>$E$1,G27:I27))=TRUE,MIN(IF(G27:I27>$E$1,G27:I27)),(DATE(YEAR(MAX(IF(G27:I27<$E$1,G27:I27)))+2,MONTH(MAX(IF(G27:I27<$E$1,G27:I27)))+6,DAY(MAX(IF(G27:I27<$E$1,G27:I27))))))
If anyone could help me figure this out, I would greatly appreciate it. I have tried reading about arrays but it hasn't gotten me anywhere

The first picture shows the values when the first formula is used for all rows. The second picture shows the value error when only that row uses the latter formula.

