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


Thanks. That worked great.


Am So 07 Okt 2012 12:38:11 CEST schrieb Andreas Säger:

Am 07.10.2012 12:28, Alaak wrote:


I have the following problem. I need to count all rows from a table
satisfying two conditions in separate columns. I know of the function
COUNTIF (ZÄHLENWENN in german), but that one is only able to consider
one condition. Let's look at a brief example.

s1 s2
a true
b true
a false
a true
b false

I would like to count all rows having the value "a" in s1 and "true" in
s2. Using COUNTIF I could either count on a condition on s1 or s2 but
not on both. Any ideas on how to solve this problem?

Thanks and regards

Counting all true "a" values
=SUMPRODUCT($A$2:$A$999="a" ; $B$2:$B$999=1)
[assuming that the true/false are numeric 1/0 values]

If the above assumption is true, you could also use
=SUMIF($A$2:$A$999 ; "a" ; $B$2:$B$999)
[each true value equals 1]

For the false "a" values:
=COUNTIF($A$2:$A$999 ; "a") - SUMIF($A$2:$A$999 ; "a" ; $B$2:$B$999)
[all "a" minus the true "a"]

If the true/false values are text:
=SUMPRODUCT($A$2:$A$999="a" ; $B$2:$B$999="true")


For unsubscribe instructions e-mail to:
Posting guidelines + more:
List archive:
All messages sent to this list will be publicly archived and cannot be deleted


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.