1

Following on from my previous question, I also record which entry records a competition. These are currently recorded as checkboxes. Counting them all is easy enough; I simply use the following function:

=COUNTIF(Stevne?;TRUE)

However, I also want to count the competitions that are specific to a type of firearm.

What I've got so far is:

=COUNTIF(Stevne?;TRUE;AND(Type:"Pistol"))

That, unfortunately, returns a Syntax error, and I can't understand why.

  • On a hunch, I tried this, still no luck, though: =COUNTIF(Stevne?;TRUE);AND(Type:"Pistol") – razumny Sep 6 '15 at 20:37
1

You need the COUNTIFS() function.

So in this case:

=COUNTIFS («gun range», true, «Firearm», "Pistol")

Accounting for ; delimiters:

=COUNTIFS («gun range»; true; «Firearm»; "Pistol")

COUNTIFS function

From the help:

The COUNTIFS function returns the number of cells in one or more collections that satisfy given conditions (one condition per collection).

COUNTIFS(test-values, condition, test-values…, condition…)

test-values: A collection containing values to be tested. test-values can contain any value.

condition: An expression that can include comparison operators, constants, the ampersand concatenation operator, and references. The contents of the condition must be such that the result of comparing the condition to another value results in the boolean value of TRUE or FALSE.

test-values…: Optionally include one or more additional collections containing values to be tested. Each test-values collection must be followed immediately by a condition expression. This pattern of test-values, condition can be repeated as many times as needed.

condition…: If an optional collection of test-values is included, an additional expression that results in a boolean TRUE or FALSE. There must be one condition expression following each test-values collection; therefore, this function will always have an odd number of arguments.

Notes

Each value in test-values is compared to the corresponding condition. If the corresponding values in each collection meet the corresponding conditional tests, the count is increased by 1.

  • That got me close enough; the commas needed to be semicolons, else it returned another syntax error. Changed that, and it now works perfectly – razumny Sep 6 '15 at 21:03
  • 1
    Sorry, I didn't realize you had different delimiters. This is for US version. Glad it worked! Of course you can use as many conditions as you want, get creative! Cheers! – bjbk Sep 6 '15 at 21:06
  • No worries; as I said you got me very close, and all I needed to do was fix the delimiters. – razumny Sep 6 '15 at 21:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .