Counting instances of the word "January" in cells B12:B80

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
On 2002-02-19 10:36, Paul B wrote:
=COUNTIF(B12:B80,"January")

what if the cell only contains the word january in the middle of the text e.g "one january morning" and you want to count the number of occurances of cells containing the word january?
 
Upvote 0
answered it my self. A classic example of ask the question before engaging brain *january* - the power of widcards (note as i type it is 3pm on a friday, not classic thinking time.
 
Upvote 0
On 2002-02-28 17:35, Anonymous wrote:
On 2002-02-19 10:36, Paul B wrote:
=COUNTIF(B12:B80,"January")

what if the cell only contains the word january in the middle of the text e.g "one january morning" and you want to count the number of occurances of cells containing the word january?

Given

{"Texas";
"January";
"Jan";
"One January morning";
"January blues in January"}

in A1:A5 and

{"January"}

in B1,


[1] in C1 enter:

=IF(LEN(B1),COUNTIF(A1:A5,"*"&B1&"*"),"")

[2] in C2 enter:

=SUMPRODUCT((LEN(A1:A5)-LEN(SUBSTITUTE(LOWER(A1:A5),LOWER(B1),"")))/MAX(1,LEN(B1)))

Added [2], in case you'd want to ask for that too.
 
Upvote 0

Forum statistics

Threads
1,223,350
Messages
6,171,590
Members
452,412
Latest member
sprichwort

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