# Restart count function after meeting condition

1. ## Restart count function after meeting condition

What formula can be used to ensure that the count function will reset once meeting a condition

Example:
A B
1
1
1
1
1
0 5 <-- Count
1
1
0 8 <-- I want this value to be 2 because i only want it to count the 1 and once there is a 0, I want the count to reset.

All help is appreciated thanks in advance

2. ## Re: Restart count function after meeting condition

Start from B2 then drag down:

=IF(A2=0,COUNTIF(\$A\$1:A2,1),"")

Untitled.png

3. ## Re: Restart count function after meeting condition

Hi bebo021999,

Thanks for the reply but this formula is not working for some reason.
I still get "7" on cell B9 instead of "2".
bebo.PNG

4. ## Re: Restart count function after meeting condition

hi Jepri, try below with slight modification

=IF(A2=0,COUNTIF(A\$1:A2,1)-SUM(B\$1:B1),"")

5. ## Re: Restart count function after meeting condition

Try with a helper column.

B2
Formula:
`Please Login or Register  to view this content.`

C2
Formula:
`Please Login or Register  to view this content.`

 Row\Col A B C 1 Data HelperColumn Result 2 1 1 3 1 2 4 1 3 5 1 4 6 1 5 7 0 1 5 8 1 2 9 1 3 10 0 1 2

6. ## Re: Restart count function after meeting condition

Thanks Alvin that formula works.

7. ## Re: Restart count function after meeting condition

Thanks Shukla for the help

#### Thread Information

##### Users Browsing this Thread

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