# 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

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off

#### 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
214
Replies
3
Views
239
Replies
8
Views
128
Replies
5
Views
86
Replies
8
Views
566

1,136,854
Messages
5,678,141
Members
419,746
Latest member
tysonboy82

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