Find latest date in a list
The image above shows a formula in cell D3 that extracts the latest date in cell range B3:B15.
The MAX function returns the largest number since Excel treats dates as numbers this will work fine. Number 1 is 1/1/1900 and 1/1/2000 is 36526. 1/2/2000 is 36527.
To extract the earliest date use the MIN function:
This returns 1/7/2007 from the list shown above.
To get the 3rd latest date use the following formula:
The LARGE function extracts the k-th largest number in a cell range. k is the second argument in the LARGE function.
To get the second earliest date use the SMALL function:
1/15/2007 is the second earliest date.
If you want to know where specific date is compared to the other dates in a list use the RANK function , in other words, if you were to sort the dates from largest to smallest where in the list would a specific date be located?
For example, 2/14/2007 would be the seventh date if the list shown above were sorted from largest to smallest.
Formula in cell B3:
The first argument in the rank function is the value you want to know the rank of. The second argument is the values you want it to be compared with.
The image above demonstrates a formula in cell F3 that returns the corresponding value on the same row as the latest date is found.
The MATCH function returns the position of the value in cell E3 in cell range B3:B15. It returns 7 because 4/8/2007 is in the seventh position in cell range B3:B15.
INDEX(C3:C15, MATCH(E3,B3:B15,0))
becomes
INDEX(C3:C15, 7)
The INDEX function then returns the value in the seventh position in cell range C3:C15 which is 199.
Question: I am trying to create an excel spreadsheet that has a date range. Example: Cell A1 1/4/2009-1/10/2009 Cell B1 […]
Find latest date based on a condition
Table of contents Lookup a value and find max date How to enter an array formula Explaining array formula Download […]
Formula for matching a date within a date range
Table of contents Match a date when a date range is entered in a single cell Match a date when […]
Count dates inside a date range
How do I automatically count dates in a specific date range? Array formula in cell D3: =SUM(IF(($A$2:$A$10<$D$2)*($A$2:$A$10>$D$1), 1, 0)) + […]
How to calculate overlapping time ranges
I found an old post that I think is interesting to write about today. Think of two overlapping ranges, it may be dates, […]
Count specific WEEKDAYS between two dates
If you want to count specific weekdays like for example Mondays and Wednesdays you need a more complicated array formula. […]
7 days (weekly) date ranges using a formula
Shannon asks:I need a formula that if I enter a start date in field B1 such as 6/8/11 it will […]
How to count workdays between two dates
Excel contains a great function that easily counts the number of workdays between two dates, it even allows you to […]
How to calculate the number of years between dates
The image above demonstrates the DATEDIF function calculating the number of complete years between two dates. Column B and column C […]
Calculate last date of a given month
The formula in cell C3 calculates the last date for the given month and year in cell B3. =DATE(YEAR(B3), MONTH(B3)+1, […]
How to comment
How to add a formula to your comment
<code>Insert your formula here.</code>
Convert less than and larger than signs
Use html character entities instead of less than and larger than signs.
< becomes < and > becomes >
How to add VBA code to your comment
[vb 1="vbnet" language=","]
Put your VBA code here.
[/vb]
How to add a picture to your comment:
Upload picture to postimage.org or imgur
Paste image link to your comment.