countif formula for a col and stop if it blanks

aravindhan_31

Well-known Member
Joined
Apr 11, 2006
Messages
672
Office Version
  1. 365
  2. 2019
  3. 2016
Platform
  1. Windows
Hi,

can you please help me to put a formula to count the number of entires in columns.

Column A to Column Z (week numbers 1-26)
ColA colB ColC ColD ColE etc...
wk1 Wk2 Wk3 Wk4 Wk5 etc...
#12 #11 #12 #13 #15
#14 #14 #14 ..... #14

from row 2 to 1000 have some data.
i want to put a formula in Column 27 to count how many times a particular data is appeared. eg if i want to know how many times "#12" appeared in column A- Z i can easily put countif like =COUNTIF(A2:Z2,"#12") which will give the number of times the value "#12" appreared, but now i want to know how many times it appreaed continesouly.

eg:
if i want to look for "#14" and if i use countif it would give me 4 as as answer but i want the result as 3 as the entry stops in colD(it will always be blank I had put ...)

All i want to get the number of times that the data appeared continueously

thanks for your help
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
continues only from begining

so for this
Code:
#14 #14 #14 Blank #14 Blank #14 #14
the answer should be 3
 
Upvote 0
Or, maybe...

=LOOKUP(9.99999999999999E+307,CHOOSE({1,2},COUNTIF(A2:Z2,"#12"),COUNTIF(A2:INDEX(A2:Z2,MATCH(TRUE,A2:Z2<>"#12",0)),"#12")))
 
Upvote 0
Thanks guys

Both of your fomulas gives me same result but i still have a problem in this

if the first entry itself is blank then the result should be nothing..

Code:
blank #14 #14 Blank #14 Blank #14 #14
 
Upvote 0
Hi,

used like this and it worked

Code:
=IF(A2="","",LOOKUP(9.99999999999999E+307,CHOOSE({1,2},COUNTIF(A2:E2,"#14"),COUNTIF(A2:INDEX(A2:E2,MATCH(TRUE,A2:E2<>"#14",0)),"#14"))))
&
Code:
=IF(A2="","",MATCH(1,INDEX((A2:Y2="#14")*(B2:Z2=""),),FALSE)-MATCH("#14",A2:Z2,FALSE)+1)
both the formula works..

thanks guys...
 
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,285
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