Using formulas, how can I count number of consecutive non zero triples?

dushkin

New Member
Joined
May 24, 2022
Messages
4
Office Version
  1. 2019
Platform
  1. Windows
Hi,
Suppose I have a column with the following values:

A
1
2
3

0
4
3
0
4
5
6

0
0
6
0
1
1

I need to count the number of the triplets without 0's.
So, in this example the triples would be: 1,2,3 and 4,5,6
Meaning my formula should return 2 to me.

How can I achieve that?
Thanks.
 
Last edited by a moderator:

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
A generic formula:
Excel Formula:
=SUM(--((INDEX(RangeA,ROW(Range1))*INDEX(RangeA,ROW(Range2))*INDEX(RangeA,ROW(Range3)))>0))
RangeA: starts from row1 of the table column and terminate 2 rows after the end of the table
Range1: the range of the table
Range2: Range1 but shifted by 1 row
Range3: Range1 but shifted by 2 rows

For example
-the data table is in N4:N19
-the formula will be
Excel Formula:
=SUM(--((INDEX(N1:N21,ROW(N4:N19))*INDEX(N1:N21,ROW(N5:N20))*INDEX(N1:N21,ROW(N6:N21)))>0))
To be confirmed using Contr-Shift-Enter, non Enter alone

Try...
 
Upvote 0

Forum statistics

Threads
1,214,919
Messages
6,122,260
Members
449,075
Latest member
staticfluids

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top