I am trying to rank (with a formula, no filters) some values using the values in another column as filters while excluding zeros from the ranking.
[TABLE="width: 500"]
<tbody>[TR]
[TD]Value[/TD]
[TD]Filter[/TD]
[TD]Formula[/TD]
[/TR]
[TR]
[TD]1.3[/TD]
[TD]1[/TD]
[TD]{=RANK.AVG(A2,IF($B$2:$B$8=1,$B$2:$B$8),1)}[/TD]
[/TR]
[TR]
[TD]2.1[/TD]
[TD]1[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]2.3[/TD]
[TD]0[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]2.0[/TD]
[TD]0[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]3.1[/TD]
[TD]0[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]2.5[/TD]
[TD]0[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]0.0[/TD]
[TD]1[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
I get a #VALUE error, because I am trying to rank the value against a binary array.
Then I tried a fancier formula, which works for the ranking excluding zeros bit but disregards the filter.
=IF(N(A2),SUMPRODUCT(1-($A$2:$A$8=0)*($B$2:$B$8=1),--($A$2:$A$8<A2))+1,"")
I care only about the rank of the first entry. So, in my example Value 1.3 would rank 1 because it is the lowest value within the array of 3 values marked by 1 in Filter. The last value would be ignored in the ranking although it is flagged, because it is a zero.
Do you have any suggestions how to achieve this in a formula?
[TABLE="width: 500"]
<tbody>[TR]
[TD]Value[/TD]
[TD]Filter[/TD]
[TD]Formula[/TD]
[/TR]
[TR]
[TD]1.3[/TD]
[TD]1[/TD]
[TD]{=RANK.AVG(A2,IF($B$2:$B$8=1,$B$2:$B$8),1)}[/TD]
[/TR]
[TR]
[TD]2.1[/TD]
[TD]1[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]2.3[/TD]
[TD]0[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]2.0[/TD]
[TD]0[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]3.1[/TD]
[TD]0[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]2.5[/TD]
[TD]0[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]0.0[/TD]
[TD]1[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
I get a #VALUE error, because I am trying to rank the value against a binary array.
Then I tried a fancier formula, which works for the ranking excluding zeros bit but disregards the filter.
=IF(N(A2),SUMPRODUCT(1-($A$2:$A$8=0)*($B$2:$B$8=1),--($A$2:$A$8<A2))+1,"")
I care only about the rank of the first entry. So, in my example Value 1.3 would rank 1 because it is the lowest value within the array of 3 values marked by 1 in Filter. The last value would be ignored in the ranking although it is flagged, because it is a zero.
Do you have any suggestions how to achieve this in a formula?