[Solved] COUNTIF() issue

Discuss the spreadsheet application
Post Reply
stanheer
Posts: 4
Joined: Sat Dec 19, 2015 12:52 am

[Solved] COUNTIF() issue

Post by stanheer »

I am using COUNTIF to count the various values in a column. There are 9 different values in a column of 47 rows. Two of these values contain parentheses.
The function returns 0(zero) for these values only. I suspect it is because of the parentheses. I have even tried copy & paste a cell's content into the formula with identical results. Is this a bug, or is there an escape character I should be using?
Last edited by stanheer on Tue Dec 04, 2018 6:43 am, edited 1 time in total.
Open Office 4.1.2 on Windows 7
FJCC
Moderator
Posts: 9271
Joined: Sat Nov 08, 2008 8:08 pm
Location: Colorado, USA

Re: COUNTIF() issue

Post by FJCC »

COUNTIF() allows regular expressions in the search term and parentheses are special characters in regular expressions. You can either go to the menu Tools -> Options, expand the Calc list on the left, choose Calculate and remove the selection from Enable Regular Expressions in Formulas or you can escape the parentheses with \.
OpenOffice 4.1 on Windows 10 and Linux Mint
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
stanheer
Posts: 4
Joined: Sat Dec 19, 2015 12:52 am

Re: COUNTIF() issue

Post by stanheer »

Thanks, I sort of expected an answer like that, but now my curiosity is piqued: Since the default is to allow Regular Expressions, what is the downside to disabling the option?
Open Office 4.1.2 on Windows 7
FJCC
Moderator
Posts: 9271
Joined: Sat Nov 08, 2008 8:08 pm
Location: Colorado, USA

Re: COUNTIF() issue

Post by FJCC »

I don't think there is a downside as long as you know that the option is there. You also have to know which functions support regular expression. FIND() does not and SEARCH() does, for example. There are multiple holes for the unwary to fall into but if you remember to check whether regular expressions are turned on and check the documentation of the functions, you can navigate the options fairly easily.
OpenOffice 4.1 on Windows 10 and Linux Mint
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
stanheer
Posts: 4
Joined: Sat Dec 19, 2015 12:52 am

Re: COUNTIF() issue

Post by stanheer »

Thanks again for the help. Marking as [Solved]
Open Office 4.1.2 on Windows 7
Post Reply