counting values in a range

pyclen

Board Regular
Joined
Jan 17, 2022
Messages
91
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
Hi Everybody,

this may have been answered somewhere previously however I did not find a solution.

I am trying to count characters in a range of cells (yea, sounds easy (and I am sure for some here it is)) however I can't figure it out
I am using Excel365 (work/home) and have the following table, and I need to count the number of times there is a C and an M in any given column.
The countif/count function works only if there is a single letter in the cells of the whole column, but when there is a combo of C and M (whether C, M or CM, no matter) it falls apart.

I also used the len/substitute formulas, as well as count(search({"C"} in that range. When I use either of these functions on any column other than the first (column D), I get a spill error.

Any help solving this issue is greatly appreciated

Book1
CDEFGHIJ
4ConditionInititalT1T2T3T4T5T6
5Condition 1C, MCCC, M
6Condition 2
7Condition 3CCCC, MC, M
8Condition 4
9Condition 5
10Condition 6
11Number of C's0220100
12Number of M's0000000
Sheet1
Cell Formulas
RangeFormula
D11:J11D11=COUNTIF(D5:D10,"C")
D12:J12D12=COUNTIF(D5:D10,"m")
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
You can use wildcards, i.e.
Excel Formula:
=COUNTIF(D5:D10,"*C*")
and
Excel Formula:
=COUNTIF(D5:D10,"*M*")
 
Upvote 0
Solution
thanks so much, appreciate it (and as I said, for sure easy for someone around here :-))
 
Upvote 0
You are welcome.
Glad I was able to help!
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,176
Members
453,021
Latest member
Justyna P

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