Selecting the three dates after specific date

Iron Contributor

Hi
I want to select the first three dates after the specific date. Is there formula do that? see the attached file
Thx.

4 Replies

@ajl_ahmed  try:

 

=IFERROR(INDEX(C7:C13,{-2;-1;0}+MATCH(F5,C7:C13,-1)),"")

 

probably could have used some of the new formulas but I this works 

actually this works a little better:

=TAKE(TAKE(C7:C13,MATCH(F5,C7:C13,-1)),-3)

because it behaves better when you are at the top of the list and only 1 or 2 are valid

both are shown in the attached for comparison

@ajl_ahmed 

As variant

=IFERROR( AGGREGATE(15,6,C7:C13/(C7:C13>F5), {1;2;3} ), "no such")

@ajl_ahmed 

Another variant into the hopper:

=LET(
    filtered, SORT(FILTER(ListA, ListA > F5, "none"), , -1),
    TAKE(filtered, -3)
)

 

 

@ajl_ahmed 

SQL:

create temp table aa as
select udf_my_date_format(f01) d,* from Sheet1 ;
select f01 from aa where d>'2023-05/26' order by d desc limit 3;

 

Screenshot_2024-08-06-16-10-36-280_com.mmbox.xbrowser.pro.jpg