Very weird problem, need help.

bomberman411

Board Regular
Joined
Oct 23, 2007
Messages
169
Hello all,

I have a weird problem that I can't figure out... might be a fluke in Excel, I just don't know.

In my spreadsheet, I have 3 different/separate cells to calculate totals that I need. All 3 checks the same long column for different things:

- one to check for zeros ("0") using
Code:
=COUNTIF($F$11:$F$5000;0)
- one to check for question marks ("?) using
Code:
=COUNTIF($F$11:$F$5000;"?")
- one to check for dashes ("-) using
Code:
=COUNTIF($F$11:$F$5000;"-")

All of these use to work fine, but recently I have noticed something. When I add a "?", the total is incremented like it should. BUT if I write a "-", I have BOTH totals (total for the question marks & total for dashes) increment at the same time...? I really don't know what could be wrong.

Please help.
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.

Andrew Poulsom

MrExcel MVP
Joined
Jul 21, 2002
Messages
73,092
The question mark is a wildcard with COUNTIF. To count the actual character you have to precede it with a tilde:

=COUNTIF($F$11:$F$5000,"~?")
 

xld

Banned
Joined
Feb 8, 2003
Messages
5,378
? is a wildcard, =COUNTIF($F$11:$F$5000;"?") is counting all cells with a single character in them. Try =COUNTIF($F$11:$F$5000;"~?")
 

bomberman411

Board Regular
Joined
Oct 23, 2007
Messages
169
Thank you very much guys...

I knew it had to be something like that, I suspected as much.
Thanks for letting me know.
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,164,160
Messages
5,835,725
Members
430,383
Latest member
Kastore

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
Top