Count Consecutive Cells Containing specific text?

slam

Well-known Member
Joined
Sep 16, 2002
Messages
873
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

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
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,215,336
Messages
6,124,329
Members
449,155
Latest member
ravioli44

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