Forum Discussion
alexw94
Jan 31, 2023Copper Contributor
How do i word this formula?
I am trying to get the following where the criteria is "Green" and/or "Red".
I am wanting to know the statement of formula for if either or both Columns A & B contain "Green" or "Red". If "Green" and/or "Red" are in Columns A & B then Column C will return "Traffic Light Colour". If neither Column A or B have these colours then it will need to return a blank cell.
Below is the outcome I am after.
Column A Column B Column C
Blue Red Traffic Light Colour
Red Blue Traffic Light Colour
Red Red Traffic Light Colour
Red Green Traffic Light Colour
Purple Blue (Blank Cell)
Blue Blue (Blank Cell)
Green Green Traffic Light Colour
Purple Blue (Blank Cell)
Blue Purple (Blank Cell)
Blue Green Traffic Light Colour
Any help please?
3 Replies
Sort By
- OliverScheurichGold Contributor
=IF(OR(COUNTIF(A2:B2,"Red")>=1,COUNTIF(A2:B2,"Green")>=1),"Traffic Light Colour","")
You can try this formula.
- alexw94Copper Contributor
OliverScheurich Many thanks, thats worked for 2, however my requirement has changed. I now need it to be searching for 3 colours rather than 2. Lets say the third colour is "Blue", how would I change that formula you have made to search for blue as well as Red and Green?
- OliverScheurichGold Contributor
=IF(OR(COUNTIF(A2:B2,"Red")>=1,COUNTIF(A2:B2,"Green")>=1,COUNTIF(A2:B2,"Blue")>=1),"Traffic Light Colour","")
You are welcome. Is this what you are looking for according to the changed requirement?