Formula to count how many times adjacent cells in a row fulfil a certain criteria

a.whitton

New Member
Joined
Sep 1, 2012
Messages
4
Hi,

I’m using Excel version 12.1.0 for Mac.

I’m having trouble making a formula that will allow me to recognize ‘episodes’ in rows of data. The criteria for an episode is that four or more adjacent cells (adjacent by column) need to have a value of 1,2 or 3.

I’d like the formula to count how many of these ‘episodes’ occur in each row.

E.g.
0 1 0 0 1 1 2 3 0 0 2 2 1 3 0 0 0 1 1 2 3 3 2 0 0 0

The formula would return a value of 3 for this row, as there are 3 lots of adjacent cells that fulfill the criteria for an ‘episode’.

My columns run from B to CG and rows run from 1 to 413 (no headers).
I’ve tried to think of a way to do this using the SUMIF function, but can’t work out how to write a formula for the ‘episode’ criteria.

If anyone has any suggestions for how to go about this it would be much appreciated!

Thanks,
Alexis.
 

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.
Hi there,

Sorry to dredge up an old thread, but I have been using the output of this thread to vet some data outputs and was wondering if it is possible to alter the output of this formula to count the number of consecutive blanks and/or zeros?

=MAX(FREQUENCY(IF(OFFSET(L3,0,0,1,COUNTA($L$2:$AK$2))="",COLUMN(OFFSET(L3,0,0,1,COUNTA($L$2:$AK$2)))),IF(OFFSET(L3,0,0,1,COUNTA($L$2:$AK$2))<>"",COLUMN(OFFSET(L3,0,0,1,COUNTA($L$2:$AK$2))))))

This formula is specific to counting blanks, I'm usually pretty proficient in excel but the use of frequency has scuppered my chances as I'm not too familiar with this formula...
 
Upvote 0
Hi there,

Sorry to dredge up an old thread, but I have been using the output of this thread to vet some data outputs and was wondering if it is possible to alter the output of this formula to count the number of consecutive blanks and/or zeros?
[...]

Assumin that A2:L2 below...

vad kadjad00

<COLGROUP><COL style="WIDTH: 48pt" span=12 width=64><TBODY>
</TBODY>

should yield 5 as result:

Control+shift+enter, not just enter...

=MAX(FREQUENCY(IF((A2:L2="")+(A2:L2=0)>0,COLUMN(A2:L2)),IF(1-((A2:L2="")+(A2:L2=0)>0),COLUMN(A2:L2))))
 
Upvote 0

Forum statistics

Threads
1,214,818
Messages
6,121,725
Members
449,049
Latest member
MiguekHeka

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