# A formula with a lot of conditions..

##### New Member
Hi, I need a field (DepField) that depends on seven other fields (Let's say the fields are named 1-7). All fields (including the dependent field can be either "Red", "Yellow" or "Green"

There are different conditions for the dependent field (DepField):

If either field: 1, 3 or 4 = "Red", then DepField = "Red"

if two or more of fields 1-7 = "Red", then DepField = "Red"

If either field: 1, 3 or 4 = "Yellow", then DepField = "Yellow"

if two or more of fields 1-7 = "Yellow", then DepField = "Yellow"

Else DepField = "Green"

Thank you for taking your time.

### Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"

#### anglais428

##### Well-known Member
I have put your range of 'fields 1 to 7' in Range B1:B7, with the below formula in cell B8:
=IF(OR(B1="Red",B3="Red",B4="Red"),"Red",IF(COUNTIF(\$B\$1:\$B\$7,"Red")>1,"Red",IF(OR(B1="Yellow",B3="Yellow",B4="Yellow"),"Yellow",IF(COUNTIF(\$B\$1:\$B\$7,"Yellow")>1,"Yellow","Green"))))

Replies
3
Views
327
Replies
3
Views
263
Replies
8
Views
172
Replies
5
Views
106
Replies
8
Views
610

1,141,127
Messages
5,704,442
Members
421,349
Latest member
Santhosh3188

### 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.

### Which adblocker are you using?

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

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