Count Max Consecutive duplicate column values, ignoring blank cells

ToddB68

New Member
Joined
Aug 16, 2009
Messages
2
Example: Count the max consecutive number of "S" entries in the following data which is stored in column A:

F
F
S
F
F

S
S
S
F
S
F
S
S

S
S
F

I tried using the following function, but it returns a 3 for the example data and I am expecting a 4..

=MAX(FREQUENCY(IF(A1:A100="S",ROW(1:100)),IF(A1:A100<>"S",ROW(1:100))))

Can someone help show how to ignore the blank cells??

Thank you,

Todd.
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Hello Todd, welcome to MrExcel,

Do you only have "F", "S" and blanks in the data? If so try changing to

=MAX(FREQUENCY(IF(A1:A100="S",ROW(1:100)),IF(A1:A100="F",ROW(1:100))))
 
Upvote 0
Hi Todd
Welcome to the board

You can also add the test to the empty cells in your formula:

=MAX(FREQUENCY(IF(A1:A100="S",ROW(1:100)),IF(A1:A100<>"S",IF(A1:A100<>"",ROW(1:100)))))
 
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,286
Members
452,902
Latest member
Knuddeluff

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