IF OR statement using multiple cells - Confused

easybpw

Active Member
Joined
Sep 30, 2003
Messages
439
Office Version
  1. 365
  2. 2013
Platform
  1. Windows
Hello,

I'm trying to construct a formula that basically does this. I'll keep it simple.

If cell A1 has "x" then G1 = "Blue" but if cell A1 and B1 both have "x" then G1 = "Blue Green" but if cell A1, B1, and C1 have "x" then G1 = "Blue Green Red". How can I do this? It' confused me for the last hour.

Thanks!

Bill
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
Try
Code:
=IF(AND(A1="x",B1="x",C1="x"),G1="Blue Green Red",IF(AND(A1="x",B1="x"),G1="Blue Green",IF(A1="x",G1="Blue",""))
 
Upvote 0
Hi,

What happens when A1 and C1 is "x", or B1 and C1 is "x" ?

Otherwise, just take out the parts G1= from above formula by JumboCactuar.
 
Upvote 0
Hi,

Thanks JTAKW, I forgot about the other scenarios. Yes, if A1 & C1 = "x" then H1 would be "Blue Red", B1 & C1 = "x" H1 = "Green Red". I am thinking this is probably not going to be possible but I hope I'm wrong.
 
Upvote 0
this what you need? place in G1

Code:
=IF(AND(A1="x",B1="x",C1="x"),"Blue Green Red",IF(AND(A1="x",B1="x",C1<>"x"),"Blue Green",IF(AND(A1<>"x",B1="x",C1="x"),"Green Red",IF(AND(A1="x",B1<>"x",C1="x"),"Blue Red",IF(AND(A1="x",B1<>"x",C1<>"x"),"Blue",IF(AND(A1<>"x",B1="x",C1<>"x"),"Green",IF(AND(A1<>"x",B1<>"x",C1="x"),"Red","")))))))

messy but works, not sure if theres a cleaner way of doing this
 
Last edited:
Upvote 0
Hi,

Thanks JTAKW, I forgot about the other scenarios. Yes, if A1 & C1 = "x" then H1 would be "Blue Red", B1 & C1 = "x" H1 = "Green Red". I am thinking this is probably not going to be possible but I hope I'm wrong.

No problem at all, it's actually very do-able, but do you want anything returned if Only B1 is X, or Only C1 is X?
 
Upvote 0
Well, seems OP has gone off-line, so I'll post my formula anyway.

As it is If None of A1, B1, C1 is X, or Only B1, or Only C1 is X, returns Blank, otherwise, as per OP's requirements:


Book1
ABCDH
1xxBlue Red
Sheet223
Cell Formulas
RangeFormula
H1=IFERROR(CHOOSE(SUM(IF(A1="X",1,0),IF(B1="X",2,0),IF(C1="X",4,0)),"Blue","","Blue Green","","Blue Red","Green Red","Blue Green Red"),"")
 
Upvote 0
And, if following OP's logic on the three different Colors, Blue for A, Green for B, and Red for C.
This covers all 8 possibilities (including all blank):


Book1
ABCDH
1xGreen
Sheet223
Cell Formulas
RangeFormula
H1=IFERROR(CHOOSE(SUM(IF(A1="X",1,0),IF(B1="X",2,0),IF(C1="X",4,0)),"Blue","Green","Blue Green","Red","Blue Red","Green Red","Blue Green Red"),"")
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,239
Members
452,621
Latest member
Laura_PinksBTHFT

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top