Solved

Way to find first date that occurs after another date in a column

Posted on 2011-02-22
8
269 Views
Last Modified: 2012-05-11
I have a column with dates in it.  I'd like to find the earliest date that occurs after 12/31/08.  In other words, if I have:
1/4/08
2/23/08
4/3/08
12/30/08
4/1/09
5/8/09
11/25/09
1/1/10
5/6/10
12/4/10
1/23/11

I'd like it to return: 4/1/09
0
Comment
Question by:BBlu
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
  • +1
8 Comments
 
LVL 22

Expert Comment

by:rspahitz
ID: 34956516
If you can sort the dates, the the VLOOKUP is perfect for this:

if B1 =12/31/08
B2 =VLOOKUP(B1, $A$1:$A$100, 1)
0
 
LVL 50

Accepted Solution

by:
barry houdini earned 75 total points
ID: 34956572
Hello rspahitz,

That will return the largest date on or before 12/31/08, in this case that's 12/30/08

BBlu

Assuming the dates are in ascending order like your example then you can use this formula

=INDEX(A2:A12,MATCH(C2+1,A2:A12)+(LOOKUP(C2+1,A2:A12)<>C2+1))

or an "array formula" to do the same which works with the dates in any order

=MIN(IF(A2:A12>C2,A2:A12))

format result cell as date

where A2:A12 contains your dates and C2 the date to match (12/31/08 in your example)

regards, barry
0
 
LVL 33

Assisted Solution

by:jppinto
jppinto earned 75 total points
ID: 34956592
If your values are on column A, put the 12/31/08 value on cell C2 and on cell C1 put this formula:

=MIN(IF(A1:A10>C2;A1:A10))

After you entered the formula in the formula bar you have to make it an array formlua by pressing CTRL+SHIFT+ENTER. Your formula should look like this:

{=MIN(IF(A1:A10>C2;A1:A10))}

jppinto
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 50

Expert Comment

by:barry houdini
ID: 34956599
See attached for examples of both formulas I suggested

regards, barry
26840320.xls
0
 
LVL 33

Expert Comment

by:jppinto
ID: 34956602
Attched working example...
MinDate.xlsx
0
 
LVL 22

Assisted Solution

by:rspahitz
rspahitz earned 75 total points
ID: 34956656
Barry, you're right (you knew that!) that the date returned with mine will be the highest date that does not EXCEED the specified date.

This will work, if you insert a new column B with a simple sequence of 1 for the first date, 2 for the next date, etc (again, assuming the dates are sorted):

=INDIRECT("A"&VLOOKUP(C1,$A$1:$B$100,2)+1)

1/4/2008	1	12/31/2008
2/23/2008	2	4/1/2009 (formula in message)
4/3/2008	3	
12/30/2008	4	
4/1/2009	5	
5/8/2009	6	
11/25/2009	7	
1/1/2010	8	
5/6/2010	9	
12/4/2010	10	
1/23/2011	11

Open in new window

0
 

Author Comment

by:BBlu
ID: 34956759
Thank you all.  I was working along the lines of the min() function with an array formula, but failed to think of the if statement part.  I also like the vlookup suggestion because it allows for finding the nth date.  Thank you all.  As usual, you guys are amazing.
0
 

Author Closing Comment

by:BBlu
ID: 34956767
Thank you all!
0

Featured Post

Enroll in June's Course of the Month

June's Course of the Month is now available! Every 10 seconds, a consumer gets hit with ransomware. Refresh your knowledge of ransomware best practices by enrolling in this month's complimentary course for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question