How to count consecutive occurances of values greater than 0?

1. How to count consecutive occurances of values greater than 0?

I'm a fundraiser for a charity. I have an excel sheet containing our individual donors' giving totals for each year--going back 15 years. Of course, few of our donors have donated every year. If the a donor did not give in a certain year, their giving total for that year is shown as 0.

I am in desperate need of a formula that will count the consecutive years a donor has given \$1 or more to our organization, counting backwards from the year 2011.

So...
If the donor gave every year for the past fifteen years, the formula will return 15.
If the donor gave only one gift, and the gift was in 2011, the formula will return 1.
If the donor did not give in 2011, the formula will return 0.
If the donor gave in 2011 and 2010, but not 2009, the formula will return 2.
If the donor gave in 14 of the last 15 years, but didn't give in 2008, the formula will return 3.

I am using Microsoft Excel 2010.

Attached is a sample of my data.

2. Re: How to count consecutive occurances of values greater than 0?

Hi and welcome to the forum.

Do you mean this? In Q2 and copy down.

=COUNTIF(B2:P2,">0")

3. Re: How to count consecutive occurances of values greater than 0?

Hi Ihorner and welcome to the forum.

The match function should work for you. See the attached..

4. Re: How to count consecutive occurances of values greater than 0?

Hi Fotis1991,

The "Countif" function is part of the solution, but in addition to counting if value is greater than zero, I need the count to begin with the left-most cell, then count to the right each cell with a value greater than zero, until it hits a cell with 0, then stop counting.

5. Re: How to count consecutive occurances of values greater than 0?

So, Marvin's suggestion, must works for you!

6. Re: How to count consecutive occurances of values greater than 0?

Yes, exactly, thank you for your help!

7. Re: How to count consecutive occurances of values greater than 0?

Yes, that was EXACTLY what I was looking for! THANK YOU!!!

8. Re: How to count consecutive occurances of values greater than 0?

Hi,

15 minus first zero.xlsx

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