# Help with IF statements ?

#### WKBX

##### New Member
I am trying to test a cell for one of 4 possible outcomes and carry the value in another cell forward if the answer is true. Similar to the example below. Can somebody suggest a way to accomplish this.

If C2 = “Apples” then carry value found in G5 to A10
If C2 = “<?xml:namespace prefix = st1 ns = "urn:schemas-microsoft-comffice:smarttags" /><st1:City w:st="on"><st1lace w:st="on">Oranges</st1lace></st1:City>” then carry value found in G6 to A10
If C2 = “Bananas” then carry value found in G7 to A10
If C2 = “Grapes” then carry value found in G8 to A10
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-comfficeffice" /><o> </o>

### Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.

#### VoG

##### Legend
Try

=IF(C2="Apples",G5,IF(C2="oranges",G6,IF(C2="Bananas",G7,IF(C2="Grapes",G8,""))))

#### WKBX

##### New Member
I can see now how to make it work, but when I use the formula exactly I get an error. It seems like it might be related to the placement of the parenthesis and/or brackets. Please forgive my ingnorance in the area. I do appreciate your help.

#### lenze

##### Legend
Copy VoG's formula exactly. It does work

lenze

#### jasonb75

##### Well-known Member
If you're having trouble understanding bracket placement on nested formulae try looking at it this way

=if(cell = value, true, false)
Using the formula supplied by VoG, I have broken this down, so that you have If and TRUE, then the FALSE shown on the next line, after your final IF statement, your last FALSE is what to do in the event that none of the criteria are TRUE, in this case "" will leave the cell blank. After this you then add a ) for every IF used.

=IF(C2="Apples",G5,
IF(C2="oranges",G6,
IF(C2="Bananas",G7,
IF(C2="Grapes",G8,
""))))

Hope that makes sense

#### WKBX

##### New Member
The problem was my source data. Thanks to all.

#### barry houdini

##### MrExcel MVP
You could also use this formula

=INDEX(G5:G8,MATCH(C2,{"Apples","Oranges","Bananas","Grapes",0))

Replies
1
Views
340
Replies
3
Views
235
Replies
5
Views
356
Replies
9
Views
417
Replies
4
Views
753

1,190,781
Messages
5,982,871
Members
439,803
Latest member
sushilneupane

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