Reputation: 11
I think I've made a mistake as it keeps returning #VALUE
.
IF(AND(G2="green",G3="green"),"GG"), IF(AND(G2="red",G3="red"),"RR"),
IF(AND(G2="red",G3="green"),"RG"), IF(AND(G2="green",G3="red"),"GR")
I'm trying to say if it is red and it is green, print RG and others such as RR,GR,GG.
Upvotes: 1
Views: 84
Reputation: 17179
The IF()
function takes three arguments: Test
,Then-value
,Otherwise-value
. So the function should look like this:
=IF(AND(G2="green",G3="green"),
"GG",IF(AND(G2="red",G3="red"),
"RR",IF(AND(G2="red",G3="green"),
"RG",IF(AND(G2="green",G3="red"),
"GR"))))
Upvotes: 2
Reputation:
Try it as,
=IF(SUM(COUNTIF(G2:G3,{"red","green"}))=2,UPPER(LEFT(G2)&LEFT(G3)), TEXT(,))
Upvotes: 1