1
votes

In a google spreadsheet I have the columns A and B populated with some data, then I have this formula to count the values in A if B=1:

=COUNTA(FILTER(A:A;B:B=1))

Problem is that the formula is counting 1 match even if there is no value matching the criteria.

This is the spreadsheet: https://docs.google.com/spreadsheet/ccc?key=0Ak9RViY8FJE5dF9PN3F2ZVFsenk3TG1LZkZjS0d4MHc#gid=0

2

2 Answers

0
votes

Thats because the filter results in Error - showing the count 1 which is error...please try

=COUNTA(IFERROR(FILTER(A1:A3,B1:B3=1),""))
0
votes

The error is being counted and the other result replaces the error with "" which would also return 1. If you want an empty filter result to return zero simply omit the second argument...

=COUNTA(IFERROR(FILTER(A1:A3,B1:B3=1)))