[Solved] COUNTIF() issue

Discuss the spreadsheet application

[Solved] COUNTIF() issue

Postby stanheer » Tue Dec 04, 2018 2:14 am

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
stanheer
 
Posts: 4
Joined: Sat Dec 19, 2015 12:52 am

Re: COUNTIF() issue

Postby FJCC » Tue Dec 04, 2018 3:38 am

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 \.
Windows 10 and Linux Mint, since 2017
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
FJCC
Moderator
 
Posts: 7204
Joined: Sat Nov 08, 2008 8:08 pm
Location: Colorado, USA

Re: COUNTIF() issue

Postby stanheer » Tue Dec 04, 2018 6:25 am

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
stanheer
 
Posts: 4
Joined: Sat Dec 19, 2015 12:52 am

Re: COUNTIF() issue

Postby FJCC » Tue Dec 04, 2018 6:37 am

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.
Windows 10 and Linux Mint, since 2017
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
FJCC
Moderator
 
Posts: 7204
Joined: Sat Nov 08, 2008 8:08 pm
Location: Colorado, USA

Re: COUNTIF() issue

Postby stanheer » Tue Dec 04, 2018 6:43 am

Thanks again for the help. Marking as [Solved]
Open Office 4.1.2 on Windows 7
stanheer
 
Posts: 4
Joined: Sat Dec 19, 2015 12:52 am


Return to Calc

Who is online

Users browsing this forum: No registered users and 18 guests