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

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
Joined
Jun 19, 2002
Messages
63,650
Try

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

WKBX

New Member
Joined
Feb 19, 2009
Messages
10
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

jasonb75

Well-known Member
Joined
Dec 30, 2008
Messages
15,488
Office Version
  1. 365
Platform
  1. Windows
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,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.
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
Top