As the title says I need to do a nth value/occurrence look up. I was able to find a maximum value by using MAX in conjunction with SUMPRODUCT and thought I could apply the same logic by using SMALL along with SUMPRODUCT.
My test sheet is set up as follows:
A3:A17 contains letters which are A, B or C, the range I need to look up is in H3:I17 (first five cells in H contain A, next five B and final five C; I contains random numbers I wish to return).
Cell A3 contains A and as it is the first occurrence, in cell B3 I wish to return the value in cell I3 (A7 contains the second occurrence of A and I would want the value from cell I4 in B4).
My formula is as follows “SUMPRODUCT(SMALL(--($H$1:$H$27=A3)*ROW($I$1:$I$27),2))”
My logic is that the part “--($H$1:$H$27=A3)*ROW($I$1:$I$27)“ will return the row numbers that “A” appears in and I should then be able to use the SMALL function to return what occurrence I want by replacing the 2 with a COUNTIF. However the SMALL function does not seem to be working for me and is just returning 0.
Any help is appreciated.
My test sheet is set up as follows:
A3:A17 contains letters which are A, B or C, the range I need to look up is in H3:I17 (first five cells in H contain A, next five B and final five C; I contains random numbers I wish to return).
Cell A3 contains A and as it is the first occurrence, in cell B3 I wish to return the value in cell I3 (A7 contains the second occurrence of A and I would want the value from cell I4 in B4).
My formula is as follows “SUMPRODUCT(SMALL(--($H$1:$H$27=A3)*ROW($I$1:$I$27),2))”
My logic is that the part “--($H$1:$H$27=A3)*ROW($I$1:$I$27)“ will return the row numbers that “A” appears in and I should then be able to use the SMALL function to return what occurrence I want by replacing the 2 with a COUNTIF. However the SMALL function does not seem to be working for me and is just returning 0.
Any help is appreciated.