Help with IF statements ?

WKBX

New Member
Joined
Feb 19, 2009
Messages
10
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-com:eek:ffice:smarttags" /><st1:City w:st="on"><st1:place w:st="on">Oranges</st1:place></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-com:eek:ffice:eek:ffice" /><o:p> </o:p>
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Try

=IF(C2="Apples",G5,IF(C2="oranges",G6,IF(C2="Bananas",G7,IF(C2="Grapes",G8,""))))
 
Upvote 0
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.
 
Upvote 0
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
 
Upvote 0

Forum statistics

Threads
1,214,962
Messages
6,122,482
Members
449,088
Latest member
Melvetica

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.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

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

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

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
Back
Top