Countif but ignore numbers AND specific character - the asterisk * symbol

little_johnny

New Member
Joined
Jan 29, 2012
Messages
30
Hello,

I am trying to count a range of mixed cells. I use the "*" symbol in my cells to add emphasis to the cell when I am looking through them.

I only want to count the cells that contain TEXT characters (representing names) - but I do not want to count cells with numbers only OR numbers + the asterisk symbol...

As you can see below, some cells contain text only, some contain numbers only, and some contain numbers OR text proceeded with an " * " or " ** " symbol.

If they contain a number, or a number with an asterix, I do not want them to be counted...

I only wish to count the cells that contain any text (essentially a person's name).


Eg:

A
1Bob
2Bob
3Bob
41
52
63
74*
8Jane
9Jane
10Jane
11Jane**
121
132
143**
15Lucy
16Lucy
17Lucy
181
192*

<tbody>
</tbody>
In this example, I want the answer to be 10 (the 10 names). I put the formula =COUNTIF(A$1:A$20,"*"), but it gives me 13.​

I understand "*" is used as a wildcard to count text, but I wish to ignore the 4*, 3**, 2*. Any help?

























Please note: this example is for illustrative purposes. My cells range in the hundreds, and a cell with a number proceeded with an asterisk (or double asterisk) could be very random (e.g.: 24*, 62*, 158**), so I can't ignore specific number AND "*", if that makes sense..?

Thanks!! :)
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Control+shift+enter, not just enter:

=SUM(IF(LEN(A1:A19),IF(1-ISNUMBER(A1:A19),IF(1-ISNUMBER(FIND("*",A1:A19)),1))))
 
Upvote 0
Ctrl + Shift + Enter the below formula
=SUM(--(ISTEXT(IFERROR(SUBSTITUTE(A1:A19,"*",1)+0,"T"))))
 
Upvote 0
Great - this one works to ignore the numbers AND the asterisk! :)

BUT- problem now. It is ignoring any cell with an asterisk. Some of my names will contain an asterisk (eg: Jane** is not being counted). Is there a way to make it count just cells with text, and ignore only individually numbered cells and numbered cells that have an asterisk?
 
Upvote 0
Control+shift+enter, not just enter:

=SUM(IF(LEN(A1:A19),IF(1-ISNUMBER(A1:A19),IF(1-ISNUMBER(FIND("*",A1:A19)),1))))

Great - this one works to ignore the numbers AND the asterisk! :)

BUT- problem now. It is ignoring any cell with an asterisk. Some of my names will contain an asterisk (eg: Jane** is not being counted). Is there a way to make it count just cells with text, and ignore only individually numbered cells and numbered cells that have an asterisk?
 
Upvote 0
Post #3 works as you expect
eg Jane** is counted but 4* is not
Great - this one works to ignore the numbers AND the asterisk! :)

BUT- problem now. It is ignoring any cell with an asterisk. Some of my names will contain an asterisk (eg: Jane** is not being counted). Is there a way to make it count just cells with text, and ignore only individually numbered cells and numbered cells that have an asterisk?
 
Upvote 0
Ctrl + Shift + Enter the below formula
=SUM(--(ISTEXT(IFERROR(SUBSTITUTE(A1:A19,"*",1)+0,"T"))))

Sorry I didn't see your reply and had already started replying to Aladin!

Ok this is working! Thank you - but I did not account for blank cells, which are also being counted, so I now have a new problem...

So to rephrase: ignore blank cells, ignore numbered cells, and ignore numbered cells with an asterisk/s - only count cells with text or text and asterisk :)
 
Upvote 0
Great - this one works to ignore the numbers AND the asterisk! :)

BUT- problem now. It is ignoring any cell with an asterisk. Some of my names will contain an asterisk (eg: Jane** is not being counted). Is there a way to make it count just cells with text, and ignore only individually numbered cells and numbered cells that have an asterisk?

I thought you didn't want Jane with stars...

Control+shift+enter, not just enter:

=SUM(IF(1-ISNUMBER(SUBSTITUTE(A1:A19,"*","")+0),1))

if there are no formula blanks (i.e., ""). Otherwise:

=SUM(IF(1-(A1:A19=""),IF(1-ISNUMBER(SUBSTITUTE(A1:A19,"*","")+0),1)))
 
Last edited:
Upvote 0
I thought you didn't want Jane with stars...

Control+shift+enter, not just enter:

=SUM(IF(1-ISNUMBER(SUBSTITUTE(A1:A19,"*","")+0),1))

Thanks for the reply Aladin, but as per my other reply to dispelthemyth - i also need to ignore blank cells (your formula also counts them)
 
Upvote 0
Thanks for the reply Aladin, but as per my other reply to dispelthemyth - i also need to ignore blank cells (your formula also counts them)

Try again. The reply has a second formula to cover that case:

=SUM(IF(1-(A1:A19=""),IF(1-ISNUMBER(SUBSTITUTE(A1:A19,"*","")+0),1)))
 
Upvote 0

Forum statistics

Threads
1,217,236
Messages
6,135,412
Members
449,930
Latest member
Theripped

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