Date: prev next · Thread: first prev next last
2016 Archives by date, by thread · List index


Rob Jasper wrote:
Pedro,

In the 'derived' view in the second tab (example 2) the empty fields under heading Nr do contain a 
formula to display the number only if something is specified in the 'map' column in the main list 
(example 1).
COUNTA also counts cells when they only contain a formula that returns an empty string. So, the 
effect is that it will count all cells.
COUNT only counts cells containing numeric values
I couldn't find how to use COUNTIF to do what I want. I always seem to have troibles with the 
formatting...
I tried:
COUNTIF(D$4:D4,"<> ")
COUNTIF(D$4:D4,'<>" "')    ##   
COUNTIF)D$4:D4,"<>''")     ## string delimited with single quotes, inside total condition withing 
double quotes

I just found 2 formats that seem to work:
COUNTIF(D$4:D4,"<>"&"")

and also
COUNTIF(D$4:D4,"<>")
No clue why this works, but it does...

You can use expressions like COUNTIF(D$4:D4,">2") to count cells with a value greater than 2.

There are two main conventions I've come across in programming languages for "not equals" - "<>" or "!=". COUNTIF seems to use "<>" - you can use an expression like COUNTIF(D$4:D4,"<>2") to count cells with a value not equal to 2, or COUNTIF(D$4:D4,"<>Hello") to count cells with a value not equal to "Hello".

I guess COUNTIF(D$4:D4,"<>") counts all cells not equal to blank.

I'd never thought of that. In the past, I've used COUNTIF(D$4:D4,".+"), which requires Tools > Options > Calc > Calculate > "Enable regular expressions in formulae" to be enabled. ".+" is a regular expression matching cells which contain one or more characters. It looks like I've been overlooking an easier (and probably efficient) solution, so thanks for mentioning that.

--
Mark.


--
To unsubscribe e-mail to: users+unsubscribe@global.libreoffice.org
Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be deleted

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.