How to count cells that have value "?"?

Hello,
I have a sheet in calc and I need to count all cells that have the following exact value: ?.
If I use countif(A1:E5,"=?") function, it counts all cells that consist of 1 character.
I tried to use =\? as criteria but it doesn’t work.

Example:


In this example, the number of “?” should be 7.

How could I solve this? Can anyone help me?
Thank you in advance!

The question mar is one of the Regular expressions.
https://help.libreoffice.org/4.4/Common/List_of_Regular_Expressions

You can try to

  • switch between the options “Use wildcard/Use regular expressions/No Wildcard or Regular expressions in the formulas” in the Calc settings: You must to decide if you need this functionality or not.
  • use a different craracter instead of the question mark
1 Like

Note that by default, wildcards are used in Calc formulas; and that means, that ? is special (as you have guessed), and it must be masked using ~, not using \.

1 Like

Hello mikekaganski,
thank you! It works well using ~.

When testing for equality you don’t need the equals sign in the condition.
Try =COUNTIF(A1:E5;"?") or =COUNTIF(A1:E5;"\?")

Hello keme1,
thank you! I tried that. You’re right, it works well without = but only "~?" works.