Multiple IF statements in one formula?

litestream

Active Member
Joined
Jul 24, 2006
Messages
323
Can I have more than one "IF" statement in a formula?

For example:

If x=1 is true, then y, if not z
If x=2 is true, then v, if not w
If x=3 is true, then t, if not u

How would I put this in a formula?
Would it be better to use some VBA coding rather than a long formula?
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Can I have more than one "IF" statement in a formula?

You can have 7 nested IF formulae in Excel....moreover writing a vba code wont allow you flexibility in modifying your work -everytime u need to perform a change in the formulae -you will need to edit the macros :wink:
 
Upvote 0
On the other hand, formulas generally take longer to run and wouldn't you have to edit your formulas too every time you make a change? I would rather edit a macro than a formula but that's just my opinion. Formulas do some amazing things too. To each his/her own :) Slink
 
Upvote 0
Interesting replies but they seem to have not provided the "how do I do it". :biggrin:

Basically once you start an IF Function Arguements, and have stated your "logical_test" you can add additional IF functions in the "Value if true and value if false", simply "click" on the IF function from the toolbar to insert additional IF functions.

Short but I hope this helps.
 
Upvote 0
Can I have more than one "IF" statement in a formula?

For example:

If x=1 is true, then y, if not z
If x=2 is true, then v, if not w
If x=3 is true, then t, if not u

How would I put this in a formula?
Would it be better to use some VBA coding rather than a long formula?

If it's not 1,2 or 3, which is it, z, w, or u?
 
Upvote 0
the "if not" part of your logic does not make sense to me, it can only be one thing, not three.

correcting for the above-mentioned, your formula should look something like:

=if(x=1,"y",if(x=2,"v",if(x=3,"t","")))

this formula will return a blank if 1,2,3 is not found. this can be changed.
 
Upvote 0

Forum statistics

Threads
1,214,975
Messages
6,122,538
Members
449,088
Latest member
RandomExceller01

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