Hi All,
I cannot find the simple way of how to get the position (row number) of the k-th value for the functions like
SMALL(array, k).
please find an example:
[TABLE="class: grid, width: 232"]
<tbody>[TR]
[TD]value[/TD]
[TD]k[/TD]
[TD]k-th smallest[/TD]
[/TR]
[TR]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD="align: right"]2[/TD]
[TD="align: right"]2[/TD]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD="align: right"]1[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]2[/TD]
[/TR]
[TR]
[TD="align: right"]3[/TD]
[TD="align: right"]4[/TD]
[TD="align: right"]3[/TD]
[/TR]
[TR]
[TD="align: right"]4[/TD]
[TD="align: right"]5[/TD]
[TD="align: right"]4[/TD]
[/TR]
</tbody>[/TABLE]
Formula in C2 is the following: =SMALL($A$2:$A$6,B2)
Formula in C3 is logically as: =SMALL($A$2:$A$6,B3)
So Excel understands that even though values are repetitive ("1" in this example), they can take different places in grading (1st and 2nd in this example)
lets say that result in C2 is the "1" in the 1st matching row of the range, and result in C3 is the "1" in the 2nd matching row of the range (if excel gives "1" twice).
So my question: is there a way to reveal the number of the row, where the 2nd "1" is, based on the criteria "k" entered in formulas above?
something like:
if k=1, show me row number of the 1st smallest value
if k=2, show me row number of the 2nd smallest value (even though values repetitive)
Solution might be simple if values (in column A) are different- we could use MATCH, VLOOKUP or other formulas, but if there are the repetitive values, MATCH and VLOOKUP give the result of the 1st match only, so if we used those, they would reveal the ROW number 2 for both cases, meaning that both 1st and 2nd smallest value is in the row 2, what is not really logical.
I tried to use OFFSET, COUNTA and other functions, but the formulas become a Kilometre of length and they do not cover cases when value repeats 3,4 or n times.
Helper Columns might be helpful but maybe there's another way how to get the result?
Hope my problem is clear enough, can't wait for the solution
Thanks in advance
I cannot find the simple way of how to get the position (row number) of the k-th value for the functions like
SMALL(array, k).
please find an example:
[TABLE="class: grid, width: 232"]
<tbody>[TR]
[TD]value[/TD]
[TD]k[/TD]
[TD]k-th smallest[/TD]
[/TR]
[TR]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD="align: right"]2[/TD]
[TD="align: right"]2[/TD]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD="align: right"]1[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]2[/TD]
[/TR]
[TR]
[TD="align: right"]3[/TD]
[TD="align: right"]4[/TD]
[TD="align: right"]3[/TD]
[/TR]
[TR]
[TD="align: right"]4[/TD]
[TD="align: right"]5[/TD]
[TD="align: right"]4[/TD]
[/TR]
</tbody>[/TABLE]
Formula in C2 is the following: =SMALL($A$2:$A$6,B2)
Formula in C3 is logically as: =SMALL($A$2:$A$6,B3)
So Excel understands that even though values are repetitive ("1" in this example), they can take different places in grading (1st and 2nd in this example)
lets say that result in C2 is the "1" in the 1st matching row of the range, and result in C3 is the "1" in the 2nd matching row of the range (if excel gives "1" twice).
So my question: is there a way to reveal the number of the row, where the 2nd "1" is, based on the criteria "k" entered in formulas above?
something like:
if k=1, show me row number of the 1st smallest value
if k=2, show me row number of the 2nd smallest value (even though values repetitive)
Solution might be simple if values (in column A) are different- we could use MATCH, VLOOKUP or other formulas, but if there are the repetitive values, MATCH and VLOOKUP give the result of the 1st match only, so if we used those, they would reveal the ROW number 2 for both cases, meaning that both 1st and 2nd smallest value is in the row 2, what is not really logical.
I tried to use OFFSET, COUNTA and other functions, but the formulas become a Kilometre of length and they do not cover cases when value repeats 3,4 or n times.
Helper Columns might be helpful but maybe there's another way how to get the result?
Hope my problem is clear enough, can't wait for the solution
Thanks in advance