Count Consecutive Cells Containing specific text?

slam

Well-known Member
Joined
Sep 16, 2002
Messages
876
Office Version
  1. 365
  2. 2019
Let's say in F2 to X2, I sometimes have the text DNS. In AN2, How can I count the consecutive instances of DNS?

Thanks
 
Last edited:
Right, DNS, DNF, DSQ, - should all be treated the same as 0-14, i.e. not included.

So, you want to exclude DNF and DSQ too...

Control+shift+enter, not just enter:
Rich (BB code):
=MAX(FREQUENCY(IF(1-ISNUMBER(MATCH(F2:X2,
 {"DNS","DNS","DSQ","-"},0))+(ISNUMBER(F2:X2)*(F2:X2>=15)),
  COLUMN(F2:X2)),IF(ISNUMBER(MATCH(F2:X2,
   {"DNS","DNS","DSQ","-"},0))+(F2:X2<15),COLUMN(F2:X2))))
 
Upvote 0

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Thank you, that works great!

(You had DNS in there twice (missing DNF), and that caught me out for a minute before I noticed). Thanks!
 
Upvote 0

Forum statistics

Threads
1,216,030
Messages
6,128,408
Members
449,448
Latest member
Andrew Slatter

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