# Formula to count consecutive non-zero values and reset count after a non-zero value

1. ## Formula to count consecutive non-zero values and reset count after a non-zero value

I am desperately seeking help with a formula. I am trying to count number of columns between non-zero values in a row and reset the count once a non-zero value is present. The problem I am trying to solve is related to perishable inventory. Each lot of inventory will be consumed according to the forecast in a first in, first out process. Once a lot has expired, the forecast should subtract from the next lot until its expiration date. I need to know how much inventory will remain upon the expiration date for each expiration quantity (expected shrink).

Row 2: Daily forecast
Row 3: Expired inventory quantity
Row 4: Expected shrink (Manual formula- this is what I am trying to solve)

2. ## Re: Formula to count consecutive non-zero values and reset count after a non-zero value

In B5 then copied across
``Please Login or Register  to view this content.``

3. ## Re: Formula to count consecutive non-zero values and reset count after a non-zero value

Thank you!!!!

4. ## Re: Formula to count consecutive non-zero values and reset count after a non-zero value

Also, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

5. ## Re: Formula to count consecutive non-zero values and reset count after a non-zero value

This worked. Marking as solved. Thank you so much kvsrinivasamurth! Added reputation for an excellent solution.

6. ## Re: Formula to count consecutive non-zero values and reset count after a non-zero value

Thanks for feedback.

There are currently 1 users browsing this thread. (0 members and 1 guests)

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1