how to count * stars in column range in excel?

genetist

Board Regular
Joined
Mar 29, 2013
Messages
75
Office Version
  1. 2016
Platform
  1. Windows
Hi to all
I would like to count number of * stars between words in a range in a column. I used this formula
=COUNTIF(rng,"*"&b1&"*"),but no success, I think excel considering * as wildcard and counting all the cells. This formula giving 9 stars (*) but actually I have 4 in my range. Any help would be highly appreciated and thanks in advance

A*CWordCount
A*A*9
G*G
C*C
T*T
AA
TT
CC
GG
<colgroup><col width="64" style="width: 48pt;" span="3"> <tbody> </tbody>

Thanks in advance
Genetist
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
Hi,

the "*" is a wildcard since the age of DOS. Try with =countif(rng, "*" & "~*" & "*")

regards
(untested)
 
Upvote 0
the "*" is a wildcard since the age of DOS. Try with =countif(rng, "*" & "~*" & "*")
Each substring is a text constant, so there is no need to concatenate them individually...

=COUNTIF(rng,"*~**")
 
Last edited:
Upvote 0
Hi

Notice that the formulas assume that there's no more that 1 asterisk in each cell.
 
Upvote 0
Each substring is a text constant, so there is no need to concatenate them individually...

=COUNTIF(rng,"*~**")
Notice that the formulas assume that there's no more that 1 asterisk in each cell.
Well, technically, the formula assumes that there is at least one asterisk in the cell, but I think I know what you are trying to tell the OP... the formula counts number of cells with one or more asterisks, not the total number of asterisks themselves. If the OP wants a count of the total number of asterisks, then I guess this formula would do that...

=SUMPRODUCT(LEN(rng)-LEN(SUBSTITUTE(rng,"*","")))
 
Last edited:
Upvote 0

Forum statistics

Threads
1,213,560
Messages
6,114,304
Members
448,564
Latest member
ED38

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