Excel #value error passing result of dynamic array formula to another function

Viewed 165

I have the following data in columns A and B. I want to filter the table by group 1 to return only the group 2 values as an array and the perform an operation on that array (in this case RANK)

If I do that as 2 steps, it works just fine

D2 formula is =TRANSPOSE(INDEX(FILTER($A$2:$B$12,$A$2:$A$12=A2), ,2)) (I put the transpose just to make readable) and the I2 Formula is =RANK.EQ(B2, D2:G2)

enter image description here

If I try to enter the function as =RANK.EQ(B2,INDEX(FILTER($A$2:$B$12,$A$2:$A$12=A2), ,2))

I get a #value cell error as an array, the same shape as the result of the filter

Can anyone help me avoid the intermediate step and figure out how to get this into a single formula? thanks in advance.

enter image description here

AMEND Thanks to @JvdV for a solution using an alternative aproach - I would be interested to know why I cant get around the error - what is it about the return value of one function that prevents me passing it to the next function? Thanks all

1 Answers

Maybe just use COUNTIFS():

enter image description here

Formula in D2:

=COUNTIFS(A2:A12,A2:A12,B2:B12,">"&B2:B12)+1
Related