Thread: count problem
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
DaveO DaveO is offline
external usenet poster
 
Posts: 94
Default count problem

You could try something like this...

Sub CountZeros()

Dim intStartCounter as integer
Dim intCounter as integer

intstartcounter = 1
intCounter = 1

do while len(range("B" & intCounter).text) < 0

do while range("B" & intCounter).text < 1

intcounter = intcounter + 1

loop

range("C" & intcounter).value = intcounter - (intstartCounter + 1)

intStartCounter = intcounter

Loop

I haven't tested this and wrote it directly here, so please check syntax.
Also, this assumes that the data is in column B and starts in row 1. If this
is wrong, you'll need to alter this in the code above.

HTH.

"muumigirl" wrote:


i have numbers 1 and 0 in column a, i would need to know how many 0 are
between ones. how could i find it out? this 1 and o sequence is very
long
A B
1 1
2 0
3 1 1
4 0
5 0
6 1 2
7 0
8 0
9 0
10 1 3
Thanks


--
muumigirl
------------------------------------------------------------------------
muumigirl's Profile: http://www.excelforum.com/member.php...o&userid=30674
View this thread: http://www.excelforum.com/showthread...hreadid=503314