0

I'm trying to understand why

{=COUNT(IF({TRUE, FALSE, TRUE}, {3,4,5}))}

returns 2 (which is the expected result) but the following returns 6

{=COUNT(IF({TRUE,FALSE,TRUE}, A1:A3))}

Here is a snapshot of the result enter image description here

The formula evaluation shows what is happening enter image description here

NOTE: This is a simplified version of a problem I am facing(i.e: it isn't just a curiosity question)

1 Answer 1

2

The two formulas are not equivalent, your second formula is equivalent to this:

=COUNT(IF({TRUE, FALSE, TRUE}, {3;4;5}))

Note: {3;4;5} not {3,4,5}

That will also return 6. As you can see from the evaluation it returns a 3x3 matrix with 6 numbers hence that result

If you want the result to be 2 you need to transpose A1:A3 like this

=COUNT(IF({TRUE,FALSE,TRUE}, TRANSPOSE(A1:A3)))

.....or use a row of values like B2:D2 in place of A1:A3

Sign up to request clarification or add additional context in comments.

3 Comments

Thank you, yes i found it a bit odd previously it was returning 2 when it was row based. If i may ask, why is not working if it is column based. I don't want to transpose it as i have 10,000 rows and i fear there might be a performance hit as this formula will be applied to every row.
I wouldn't say it's not working - it's doing what I would expect - if you compare a row to a column in excel you will get a matrix result, e.g. = =A1:A5=B1:F1 gives you a 5x5 matrix result
@fuadj Probably stating the obvious, but it is also possible to get your desired result by transposing the array of TRUE/FALSE values.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.