Struggling with IF(AND formula (Please Help)

ericcarl

New Member
Joined
Apr 7, 2016
Messages
7
Hello Forum,
I'm struggling with a nested formula that uses several IF statements and two IF(AND) statements. The formula is shown below. The error message I receive is "The specified formula cannot be entered because it uses more levels of nesting than are allowed in the current file format". The two IF(AND statements at the end worked fine with just the two of them. I thought Excel could handle many more levels of nesting than just this? At the end of the formula, cells K12 and K13 refer to locations as in the IF statements that precede them.


Can anyone please tell me what I'm doing wrong here? I'm sure it's something simple that I'm overlooking - I'm just not very good at multiple nesting in a formula. Your help is greatly appreciated!


=IF(H2="Gala","Oregon",IF(H2="Jazz","Maine",IF(H2="Golden Delicious","California",IF(H2="Granny Smith","Washington",IF(H2="Braeburn","Florida",IF(H2="Lady","Idaho",IF(H2="Gravenstein","New York",IF(AND(H2="Honeycrisp",AA2="ILA"),K12,IF(AND(H2="Honeycrisp",AA2="ILD"),K13,"Wrong Value")))))))))


Thank you in advance,
greykitten
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
Are you using an Excel earlier than 2007? Then the limit is 6 or 7. This worked fine when I tested in version 2010. But you really should consider a lookup table in the formula or somewhere on the worksheet instead.
 
Last edited:
Upvote 0
Sorry, I should have specified the version of Excel. Yes, it is on xls (97-2003). Hypothetically, the formula could run in an xlsx version of the file and then the values could be cut and pasted as only values and then saved as xls. Do you think VLOOKUP would be more effective? How would that look in practice where the final two checks have to meet two conditions? Thanks so much for your help!
 
Upvote 0
How about:


Excel 2010
ABCDEFGHIJKLMNOPQRSTUVWXYZAA
1yGalaOregon
2JazzMaineHoneycrispILA
3Golden DeliciousCalifornia
4Granny SmithWashington
5BraeburnFlorida
6LadyIdaho
7GravensteinNew York
8
9
10
11
12x
13y
Sheet5
Cell Formulas
RangeFormula
A1=IF(AND(H2="Honeycrisp",AA2="ILD"),K12,IF(AND(H2="Honeycrisp",AA2="ILA"),K13,IF(ISERROR(VLOOKUP(H2,$B$1:$C$7,2,0))=FALSE,VLOOKUP(H2,$B$1:$C$7,2,0),"Wrong Value")))
 
Upvote 0
Does this help? I cut couple IFs:
Code:
=IF(AND(H2="Honeycrisp",AA2="ILA"),K12,IF(AND(H2="Honeycrisp",AA2="ILD"),K13,IF(H2<>"Honeycrisp",CHOOSE(MATCH(H2,{"Gala","Jazz","Golden  Delicious","Granny  Smith","Braeburn","Lady","Gravenstein"},0),"Oregon","Maine","California","Washington","Florida","Idaho","New  Yor"),"Wrong Value")))
 
Upvote 0

Forum statistics

Threads
1,216,073
Messages
6,128,646
Members
449,462
Latest member
Chislobog

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