Search code examples
google-sheetsarray-formulas

ARRAYFORMULA with FILTER and ARRAY_CONSTRAIN with dynamic dates


I need to make an ARRAYFORMULA but can't make it with FILTER and ARRAY_CONSTRAIN inside.

I need to get value for biggest date in range less than condition. I hope example will be better for understanding.

My current formula is here and i need convert it to ARRAYFORMULA:

=IF(H2="",,IFERROR(ARRAY_CONSTRAIN(SORTN(FILTER($H$2:$I,$G$2:$G=A2,$I$2:$I<=B2),1,0,2,0),1,1),"No data"))

Here is an example: https://docs.google.com/spreadsheets/d/18epXaPUFLR2DeO5Mjy3nyhPskXVtA9P8WAil5q5JmKo/edit?usp=sharing


Solution

  • You may try:

    =map(A2:A,B2:B,lambda(a,b,if(or(a="",b="",,),,ifna(vlookup(b,filter({I:I,H:H},G:G=a),2,1),"No data"))))
    

    enter image description here