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

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.

Stormseed

Banned
Joined
Sep 18, 2006
Messages
3,274
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:
 

SlinkRN

Well-known Member
Joined
Oct 29, 2002
Messages
701
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
 

MidNiteRaver

New Member
Joined
Jul 18, 2005
Messages
32
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.
 

Brian from Maui

MrExcel MVP
Joined
Feb 16, 2002
Messages
8,458
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?
 

cheveley

Active Member
Joined
Sep 24, 2002
Messages
273
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.
 

Forum statistics

Threads
1,136,879
Messages
5,678,327
Members
419,756
Latest member
vincent86kapelski

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