Type in a date and it doesnt exist in database, Need to return the Next largest date

NewUser2

Board Regular
Joined
Jan 27, 2015
Messages
54
So I am using a spreadsheet where on 'Page 1' I have a list of 10's of thousands of dates ranging from 2006 to now, (thousands because some days repeat), however there isn't a listing for Every date in that range.

On 'Page 2' I have a form where I get the user to type in a date (In cell A1) in the same format as the previous sheet (yyyy/mm/dd) once done several other cells will auto populate based on that date and other select criteria.

My problem: I am looking for a formula that I can use on 'Page 2' cell A2 that will either A) return the same date from cell A1 if it exists and B) IF the date entered in cell A1 is not in the database, it will return the next largest date. (So if I wanted jan 1st but its not there, cell a2 would return jan 3rd (assuming it is there and jan 2nd isnt)).

Note: I have tried using IF(INDEX(MATCH....-1))) having the -1 return the next positive value. But the error that occurs is my dates Have to be in ascending order as a lot of other things require it.

Please help!
Thanks
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
OK, two possible approaches...

You can try this "array formula" in sheet2 B1

=MIN(IF(Sheet1!A$1:A$100000>=A1,Sheet1!A$1:A$100000))

confirmed with CTRL+SHIFT+ENTER

or, longer but faster

=IF(LOOKUP(A1,Sheet1!A$1:A$100000)=A1,A1,INDEX(Sheet1!A$1:A$100000,MATCH(A1,Sheet1!A$1:A$100000)+1))
 
Upvote 0
Eureka!

Thank you for your help. I have been staring at that spread sheet for hours trying to get it. I'll need to try incorporating it into my sheet at work tomorrow to see if it can handle the various IF statements but it should be good.

Thanks again.


OK, two possible approaches...

You can try this "array formula" in sheet2 B1

=MIN(IF(Sheet1!A$1:A$100000>=A1,Sheet1!A$1:A$100000))

confirmed with CTRL+SHIFT+ENTER

or, longer but faster

=IF(LOOKUP(A1,Sheet1!A$1:A$100000)=A1,A1,INDEX(Sheet1!A$1:A$100000,MATCH(A1,Sheet1!A$1:A$100000)+1))
 
Upvote 0

Forum statistics

Threads
1,217,345
Messages
6,136,026
Members
449,978
Latest member
mtbe

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