I have four columns with cells that can have values A or B and I want to change the value of a fifth cell if columns contain either value. Here is an example.
If I
, K
, and O
all contain the value A
or B
I want column P
to say TRUE
If I
, M
, and O
all contain the value A
or B
I want column P
to say TRUE
If K
, M
, and O
all contain the value A
or B
I want column P
to say TRUE
To populate column P
, column O
always needs to have a value of A or B, and two of the three columns IK and M have to have either value "A" or "B".
Here is a formula a thought would work, but I cannot figure out how to check if a cell equals one of two values. For example: I2="A" OR "B", K2="A" OR "B", O2="A" OR "B"
=IF(AND(I2="A", K2="A", O2="A"),"TRUE","")
I also tried changing the values A
and B
to digits 1
and 2
, and adding them up, but it didn't seem to work properly because i could reach the sum of 3 with only two columns. I apologize if I am not explaining this properly..
=IF(AND(K1+M1>=2,N1>=85),"TRUE",IF(AND(I1+M1=2,N1>=85),"TRUE",IF(AND(K1+I1=2,N1>=85),"TRUE","")))
There are number of way to do it. My solution is to use COUNTIF, assuming that neither "A" or "B" would never appear in column J,L,N.
=AND(COUNTIF(I2:M2,"A")+COUNTIF(I2:M2,"B")>1, OR(O2="A", O2="B"))
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.