Count function use case

Davidns

Board Regular
Joined
May 20, 2011
Messages
159
Office Version
  1. 365
Platform
  1. MacOS
I have a column wherein the initial rows have a value of zero, followed by a series of non-zero numbers, then followed by more zeroes. Example:
0
0
0
0
0
100
100
100
100
0
0
0
0

What would be the best formula to use to count the number of cells with a value of zero BEFORE the non-zero numbers start? In other words, I do not want to include the zeros after the non zero numbers in the count.
Thanks!
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
How about
Fluff.xlsm
AB
1
205
30
40
50
60
7100
8100
9100
10100
110
120
130
140
Data
Cell Formulas
RangeFormula
B2B2=XMATCH(TRUE,A2:A100>0)-1
 
Upvote 0
Solution
Wow, works like a charm. Thank you - would never have come up with that on my own, and frankly, not quite following why it works but glad it does. Much appreciated! (if you have a moment to explain what is going on, I would be very grateful - the "True" part is throwing me)
 
Upvote 0
This part A2:A100>0 returns an array of true/false & the xmatch looks for the 1st TRUE
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,223,898
Messages
6,175,274
Members
452,628
Latest member
dd2

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