Excel formula to search if all cells in a range read "True", if not, then show "False"
Asked Answered
D

4

25

Using an excel formula to search if all cells in a range read "True", if not, then show "False"

For example:

A      B     C     D
True  True  True   True
True  True  FALSE  True

I want a formula to read this range and show that in row 2, the was a "False" and since there are no falses in row 1 I want it to show "true."

Can anyone help me with this?

Diantha answered 5/3, 2014 at 15:37 Comment(2)
just =AND(A1:D1)Cosgrove
That didn't work. I want it to look at columns A-D as the range and say "False" if any falses exist. I am using this as a check and have many columns so it would be nice instead of checking each column for falses that I could look in one column and identify the rows that did show a "false."Diantha
H
7

As it appears you have the values as text, and not the numeric True/False, then you can use either COUNTIF or SUMPRODUCT

=IF(SUMPRODUCT(--(A2:D2="False")),"False","True")
=IF(COUNTIF(A3:D3,"False*"),"False","True")
Hooghly answered 5/3, 2014 at 16:49 Comment(2)
The COUNTIF formula worked! Thank you so much! I was writing the exact same formula but I didn't include the * after false. If you happen to read this, would you mind sharing why that symbol was needed? Thanks again!!Diantha
@user3384215, without the *, Excel translates "False" to the logical value, rather than keeping it as text. The * forces it into a string, which will then allow it to match the text in the cells. Note that the * will also mean it would match Falses, FalseStuff, and anything else that begins with those 5 lettersHooghly
V
41

You can just AND the results together if they are stored as TRUE / FALSE values:

=AND(A1:D2)

Or if stored as text, use an array formula - enter the below and press Ctrl+Shift+Enter instead of Enter.

=AND(EXACT(A1:D2,"TRUE"))
Vereen answered 9/1, 2015 at 9:2 Comment(1)
My data is certainly 'native' TRUE/FALSE boolean values; so the straight AND(..) worked for me!Investiture
H
7

As it appears you have the values as text, and not the numeric True/False, then you can use either COUNTIF or SUMPRODUCT

=IF(SUMPRODUCT(--(A2:D2="False")),"False","True")
=IF(COUNTIF(A3:D3,"False*"),"False","True")
Hooghly answered 5/3, 2014 at 16:49 Comment(2)
The COUNTIF formula worked! Thank you so much! I was writing the exact same formula but I didn't include the * after false. If you happen to read this, would you mind sharing why that symbol was needed? Thanks again!!Diantha
@user3384215, without the *, Excel translates "False" to the logical value, rather than keeping it as text. The * forces it into a string, which will then allow it to match the text in the cells. Note that the * will also mean it would match Falses, FalseStuff, and anything else that begins with those 5 lettersHooghly
W
3
=IF(COUNTIF(A1:D1,FALSE)>0,FALSE,TRUE)

(or you can specify any other range to look in)

Watchtower answered 5/3, 2014 at 15:45 Comment(3)
I tried this but it did not work. I looked on one of my rows that I knew contained a false as a check and the formula you suggested return a true.Diantha
I think it may be because the cells contain text. That why I have been confused on getting this to work.Diantha
You can simplify this by just saying =COUNTIF(A1:D1, FALSE)=0Vereen
T
1
=COUNTIFS(1:1,FALSE)=0

This will return TRUE or FALSE (Looks for FALSE, if count isn't 0 (all True) it will be false

Tomlinson answered 1/11, 2019 at 21:15 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.