Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

How to rank highest to lowest by counting negative values?

enter image description here

I would probably use something like this follow by if elseif logic but I can't seems to figure it out

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

If CountApple > CountOrange then or endif...

Maybe there is a better way to do this?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
173 views
Welcome To Ask or Share your Answers For Others

1 Answer

You could use this formula:

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

enter image description here


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...