# Need some help with an IF statement

#### superkopite

##### Board Regular
Hi Guys and Gals,

I have the statement =IF(O\$2=\$C3,1,)

and I need to amend it slighty. At the moment the highlighted cell will display a 1 if the value of o2 is equal to c3. What i want to do is that add another condition, so if o2=C4 AND C4 is equal to green then 1,if it is equal to Amber then 2, and 3 if it is equal to Red.

I am sure I know how to do this but think I have just confused myself, lol

Many Thanks

James

Last edited:

### Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
I have tried

=IF(and(G\$2=\$C3, e3="green"),1,if(and(G\$2=\$C3, e3="Amber"),2,if(and(G\$2=\$C3, E3="red",3,0)

But I am missing the ))) and cannot work out where to put them

any ideas??

Thanks

Hi,

Just at the end of your formula ...

Thanks James,

I tried that but I get the "the forumla that you typed contains an error" message

looks like you're missing a parenthesis after the 3rd AND

=IF(AND(G\$2=\$C3, E3="green"),1,IF(AND(G\$2=\$C3, E3="Amber"),2,IF(AND(G\$2=\$C3, E3="red"),3,0)))

Thanks Weazel!!

That worked a treat!!!

Replies
6
Views
132
Replies
2
Views
113
Replies
1
Views
139
Replies
3
Views
255
Replies
1
Views
295

1,206,754
Messages
6,074,750
Members
446,082
Latest member
fgiron83

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