Number of consecutive cells in a row

Brecht

Member
Joined
Sep 15, 2014
Messages
36
Reaction score
0
Points
6
Location
Netherlands
Excel Version(s)
Version 2007
Hi all

I have an excel table that looks like this

BC
DEF
1)0
11410
2)02591
3)
34900
4)26353
5)87010
6)46510
7)103210
8)000160

(Letters are column letters; 1) etc are row numbers)

What I want is a formula that lets me know the range of cells that are larger than 0 .
So I'd get
1) = 3
2) = 4
3) = 3
4) = 5
5) = 4 (despite the 0 in the middle)
7) = 4
8) = 1

Can anyone help me out with this?

Much appreciated!
 
No, you haven't!

What's the logic of your suggested answer for row 5?
 
No, you haven't!

What's the logic of your suggested answer for row 5?

I need therange of cells - not sure if this is the correct English word for it.
So I want the number of cells starting from the first value larger than 0, ending with the last value larger than 0 .
So if
A1 = 3
B1 = 0
C1 = 2

The result should be 3.
 
If I understand you correctly, then this formula will work : =(MAX(IF(B1:F1>0,COLUMN(B1:F1),"")))-1. The " -1 " at the end of the formula simply subtracts the column which houses the formula itself. I assume my formula to be in A1 ( Column A ).
 
Optional response to your true meaning : =(MAX(IF(B1:F1>0,COLUMN(B1:F1),"")))- COUNTIF(B1:F1,0)
 
Back
Top