View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
Zachary Baker Zachary Baker is offline
external usenet poster
 
Posts: 1
Default Counting Loop - Please help

I'm working on a forecasting program for my Industrial Engineering Senior
Design group. We need a function that can count in the following way.

Given the column:

1
3
4
2
0
0
2
5
0
4

This program should return

1
1
1
1
0
0
3
1
0
2

What this program is doing is looking at each cell in the column. If the
cell is zero, the function will return a 0 for the corresponding cell and
look forward to the next cell. If it is zero again, it will return a 0 and
continue in the loop until it reaches a nonzero. Upon reaching a nonzero, it
will count itself and the number of zero cells before it and return that
value. If there is a nonzero cell proceeded by a nonzero cell, the function
will simply return one.

I know this sounds crazy but we are desperate for help.

Thanks.

-
Zachary