Proper use of DCOUNTA() in Google Sheets

google sheets

I'm trying to count data in my database using multiple criteria as in

=DCOUNTA(DatosBanderas;"MUNICIPIO";{{"Correcto";"=true"},{"Provincia";"=Barcelona"}})

I get Formula parse error. However, simpler queries as

 =DCOUNTA(DatosBanderas;"MUNICIPIO";{"Correcto";"=true"})

or

 =DCOUNTA(DatosBanderas;"MUNICIPIO";{"Provincia";"=Barcelona"})

do work. Using

=DCOUNTA(DatosBanderas;"MUNICIPIO";critrange)

with "critrange" a two by two cell range with contents "Provincia", "Correcto" in the top row and "Barcelona" and "true" in the bottom row also does work.

What am I doing wrong?

Best Answer

Try this:

=DCOUNTA($A$1:$D$7;"MUNICIPIO";{{"Correcto";"TRUE"}\{"Provincia";"Barcelona"}})

(for countries using decimal comma separators)

OR

=DCOUNTA($A$1:$D$7,"MUNICIPIO",{{"Correcto";"TRUE"},{"Provincia";"Barcelona"}})

(for countries using decimal point notation)


The condition is the value of the cell, so it is:

  • "TRUE" rather than =true, and
  • "Barcelona"rather than "=Barcelona"