IF commands Longer then 7

davethearchitect

New Member
Joined
Jun 21, 2007
Messages
9
Hello,

I know there is away to do this, I just cant remember how to. I need a formula that is similar to the IF command but allows more then 7

Thanks
Dave
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
In all the BASICs, such as BASIC, GWBASIC, QuickBASIC, VisualBASIC and VisualBASIC for Applications, the maximum number of nested functions is seven, plus the enveloping function, so, we can have a total of eight functions, seven of which are nested.

In Excel, we can concatenate as many as 30 statements, or formulas.

So, to get, say, ten IFs for numbers, one can use the following example, which only concatenates two formulas, each with only four nested IFs. Notice that one must make allowance for failure of the preceding IFs in each part, or formula, to ensure success:
In B1, enter:
=IF(A1=1,1,IF(A1=2,2,IF(A1=3,3,IF(A1=4,4,IF(A1=5,5,0))))) + IF(A1=6,6,IF(A1=7,7,IF(A1=8,8,IF(A1=9,9,IF(A1=10,10,0)))))

It is generally understood that the use of this type of solution is better addressed by using VBA, when the total formula gets a little bit longish :)
 
Upvote 0
Hello,

I know there is away to do this, I just cant remember how to. I need a formula that is similar to the IF command but allows more then 7

Thanks
Dave

Describe the problem you want to take up... More often than not, a long chain of IF's can be replaced with a lookup formula.
 
Upvote 0
a lookup or a choose function can also work. You could always do something like:

Code:
=IF(A1=5,2,0)+IF(AND(NOT(A1=5),A2=5,3,0)+...
or
Code:
=IF(A1="test","Result One","")&IF(A1="fargo","Result Two","")&...

There are generally other acceptable ways to right a formula when one may perceive the need for more than 7 nests. Could you post the formula as you would want it if excel allowed more than 7?
 
Upvote 0
The limit for nested IFs is 7, but when you reach or approach that limit it's normally possible to use other functions.

What other functions to use it really up to what you actually want to achieve.

You might be able to use Roy's suggestion but there might be other functions you can use.

Ralph

I've never heard of a limitation on nested If's in VB or VBA, or any other basic languages.:)
 
Upvote 0
Ralph, prior to Excel 2007 the limit for nesting Functions was 7, with 2007 it's now 64.

With VBa I don't believe there is any restriction, although with mltiple Ifs a Select Case statement is usually better.
 
Upvote 0
Norie, and everybody else that read my post above:

Accept my apologies for stating as a fact what I thought was true; it is not. I should have said, "In Excel, statements can be nested up to seven times".
 
Upvote 0
Norie, and everybody else that read my post above:

Accept my apologies for stating as a fact what I thought was true; it is not. I should have said, "In Excel, statements can be nested up to seven times".

Not a problem we all make mistakes.
 
Upvote 0

Forum statistics

Threads
1,214,911
Messages
6,122,198
Members
449,072
Latest member
DW Draft

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