VBA - 通过计算负值从高到低排名?

VBA - Ranking Highest to Lowest by Counting Negative Values?

如何通过计算负值从高到低排序?

我可能会在 if elseif 逻辑之后使用类似这样的东西,但我似乎无法弄清楚

Set CountRng = range("B1:E1") 
CountApple = Application.WorksheetFunction.CountIf(CountRng, "<0")
CountOrange ..
CountBanana ..

If CountApple > CountOrange then or endif...

也许有更好的方法?

你可以使用这个公式:

=SUMPRODUCT(--(COUNTIF(OFFSET($B,(ROW(:)-1),0,1,4),"<0")>COUNTIF(B1:E1,"<0")))+1