By: Naimul Hasan Arif

In reply to CJ.

Hello CJ,

Thanks for your comment. To go into the details of your queries, let me break down the formula for you used in method 6 in a simpler form first.
The whole formula was:
=IFERROR(INDEX($D$5:$D$11, MATCH(ROWS($D$10:D10), COUNTIF($D$5:$D$11, “<=”&$D$5:$D$11), 0)), “”)

Here, the ROWS function counts the number of rows in the defined array.
ROWS($D$10:D10) → 1

The COUNTIF function compares the values in the given range and denotes them with a number based on the position in the smallest to largest order.
COUNTIF($D$5:$D$11, “<=”&$D$5:$D$11) → {4;6;1;5;2;3;7}

The MATCH function compares the values returned by the ROWS & COUNTIF functions and returns the index number of the position of the exact match.
MATCH(1, COUNTIF($D$5:$D$11, “<=”&$D$5:$D$11), 0))
MATCH(1, {4;6;1;5;2;3;7})→ 3

The INDEX function returns the third date value from the defined range in general form.
INDEX($D$5:$D$11, MATCH(ROWS($D$10:D10), COUNTIF($D$5:$D$11, “<=”&$D$5:$D$11), 0))
INDEX($D$5:$D$11, 3) → 43811
If there is an error in finding a date, the IFERROR function will return a blank cell as an output.

While applying the ROWS function, I have set a reference point from D10 and also finished the array on D10. That returns the number of row count 1. However, it is not mandatory that you have to set the reference point from D10. You can start from any cell between D5 to D11 but the starting and ending cell reference should be the same in that array. You can apply “ROWS($D$5:D5)” and it will return 1 too which is the same output.

If I am not wrong, the IFERROR function was introduced in the 2007 Excel version and the INDEX, MATCH, COUNTIF, & ROWS functions are available in the earliest Excel versions too. So, I hope it will work perfectly from the 2007 and the later Excel versions.
This formula can be applied to a dynamic table. It will automatically sort dates within the given range.

I hope you have the answers that you were looking for.

Regards,
Naimul Hasan Arif