the specified formula cannot be entered because it uses more levels of nesting than are allowed

sammy7

New Member
Joined
Mar 2, 2017
Messages
4
Hi

Can you please help me shorten this formula so the excel can accept it without giving an error.

=IFERROR(IF(AG2="","",IF(AG2="Primary",D2,IF(LEFT(E2,LEN(E2))=LEFT(AI2,LEN(E2)),D2,IF(COUNTIF([PERSONAL.XLSB]Sheet1!$AA1:$AA200,LEFT(LEFT(AI2, FIND(".",AI2, FIND(".",AI2)+1)),LEN(LEFT(AI2, FIND(".",AI2, FIND(".",AI2)+1)))-1))>0,VLOOKUP(LEFT(LEFT(AI2, FIND(".",AI2, FIND(".",AI2)+1)),LEN(LEFT(AI2, FIND(".",AI2, FIND(".",AI2)+1)))-1),[PERSONAL.XLSB]Sheet1!$AA1:$AB200,2,0),INDIRECT("D"&MATCH(AF2&"Primary",AF:AF&AG:AG,0))))),"Not Found")
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
this fits

Code:
=IFERROR(IF(AG2="","",IF(OR(AG2="Primary",LEFT(E2,LEN(E2))=LEFT(AI2,LEN(E2))),D2,IF(COUNTIF([PERSONAL.XLSB]Sheet1!$AA1:$AA200,LEFT(LEFT(AI2, FIND(".",AI2, FIND(".",AI2)+1)),LEN(LEFT(AI2, FIND(".",AI2, FIND(".",AI2)+1)))-1))>0,VLOOKUP(LEFT(LEFT(AI2, FIND(".",AI2, FIND(".",AI2)+1)),LEN(LEFT(AI2, FIND(".",AI2, FIND(".",AI2)+1)))-1),[PERSONAL.XLSB]Sheet1!$AA1:$AB200,2,0),INDIRECT("D"&MATCH(AF2&"Primary",AF:AF&AG:AG,0))))),"Not Found")
 
Upvote 0
Thank you so much for your response. It fits no doubt, but there was some inconsistency with the data which gave trouble afterwards. So ended up fixing that and further shortening the formula to:

Code:
=IFERROR(IF(AG2="","",IF(AG2="Primary",D2,IFERROR(INDIRECT("D"&MATCH(AF2&"Primary",AF:AF&AG:AG,0)),VLOOKUP(LEFT(LEFT(AI2, FIND(".",AI2, FIND(".",AI2)+1)),LEN(LEFT(AI2, FIND(".",AI2, FIND(".",AI2)+1)))-1),[PERSONAL.XLSB]Sheet1!$AA1:$AB200,2,0)))),"Not  Found")
 
Upvote 0

Forum statistics

Threads
1,215,706
Messages
6,126,334
Members
449,309
Latest member
kevinsucher

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