Counting cells when Values are Zero or None

TheTiredEngineer

New Member
Joined
Jul 31, 2024
Messages
31
Office Version
  1. 365
Platform
  1. Windows
So Ive got a column of data like below and I need it to skip & recount if theres any "None" or zeros in column A. Id prefer this to be accomplished via formulas. I tried countif and its not working right.

231
None
122
123
554
None
255

Sometimes the data can look like this, where the first is a zero and theres a few other zeros.

None
251
122
123
None
254
None
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Hi

Do you mean something like this?

Book1
AB
1
2231
3None 
4122
5123
6554
7None 
8255
Sheet2
 
Upvote 0
Book1
ABC
1
2231
3None 
4122
50 
6553
7None 
8254
9
Sheet2
Cell Formulas
RangeFormula
B2:B8B2=IF((A2=0)+(ISNUMBER(SEARCH("none",A2))), "", MAX($B$1:$B1)+1)
 
Upvote 0
Another option:

Excel Formula:
=LET(
a,A1:A7,
IF((a<>"None")*(a<>0),SCAN(0,a,LAMBDA(x,y,IF((y<>0)*(y<>"None"),x+1,x))),""))
 
Upvote 0
dave3009, short formula:

=IF((A2=0)+(A2="none"),"",MAX($B$1:$B1)+1)
or
=IF(OR(A2={0,"none"}),"",MAX($B$1:$B1)+1)
 
Upvote 0
Solution

Forum statistics

Threads
1,223,236
Messages
6,170,912
Members
452,366
Latest member
TePunaBloke

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top