"=IF" with more than 64 levels of nesting

LONI

New Member
Joined
Feb 23, 2021
Messages
1
Office Version
  1. 2019
Platform
  1. Windows
I have the formula but how do I use the "Lookup" formula so I can have more than 64 levels of nesting?
I tried and I keep getting an error when I try to use the "Lookup" formula

The formula is:

=IF(B:B=Inventory!A2,Inventory!B2:D2,IF(B:B=Inventory!A3,Inventory!B3:D3,IF(B:B=Inventory!A4,Inventory!B4:D4,IF(B:B=Inventory!A5,Inventory!B5:D5,IF(B:B=Inventory!A6,Inventory!B6:D6,IF(B:B=Inventory!A7,Inventory!B7:D7,IF(B:B=Inventory!A8,Inventory!B8:D8,IF(B:B=Inventory!A9,Inventory!B9:D9,IF(B:B=Inventory!A10,Inventory!B10:D10,IF(B:B=Inventory!A11,Inventory!B11:D11,IF(B:B=Inventory!A12,Inventory!B12:D12,IF(B:B=Inventory!A13,Inventory!B13:D13,IF(B:B=Inventory!A14,Inventory!B14:D14,IF(B:B=Inventory!A15,Inventory!B15:D15,IF(B:B=Inventory!A16,Inventory!B16:D16,IF(B:B=Inventory!A17,Inventory!B17:D17,IF(B:B=Inventory!A18,Inventory!B18:D18,IF(B:B=Inventory!A19,Inventory!B19:D19,IF(B:B=Inventory!A20,Inventory!B20:D20,IF(B:B=Inventory!A21,Inventory!B21:D21,IF(B:B=Inventory!A22,Inventory!B22:D22,IF(B:B=Inventory!A23,Inventory!B23:D23,IF(B:B=Inventory!A24,Inventory!B24:D24,IF(B:B=Inventory!A25,Inventory!B25:D25,IF(B:B=Inventory!A26,Inventory!B26:D26,IF(B:B=Inventory!A27,Inventory!B27:D27,IF(B:B=Inventory!A28,Inventory!B28:D28,IF(B:B=Inventory!A29,Inventory!B29:D29,IF(B:B=Inventory!A30,Inventory!B30:D30,IF(B:B=Inventory!A31,Inventory!B31:D31,IF(B:B=Inventory!A32,Inventory!B32:D32,IF(B:B=Inventory!A33,Inventory!B33:D33,IF(B:B=Inventory!A34,Inventory!B34:D34,IF(B:B=Inventory!A35,Inventory!B35:D35,IF(B:B=Inventory!A36,Inventory!B36:D36,IF(B:B=Inventory!A37,Inventory!B37:D37,IF(B:B=Inventory!A38,Inventory!B38:D38,IF(B:B=Inventory!A39,Inventory!B39:D39,IF(B:B=Inventory!A40,Inventory!B40:D40,IF(B:B=Inventory!A41,Inventory!B41:D41,IF(B:B=Inventory!A42,Inventory!B42:D42,IF(B:B=Inventory!A43,Inventory!B43:D43,IF(B:B=Inventory!A44,Inventory!B44:D44,IF(B:B=Inventory!A45,Inventory!B45:D45,IF(B:B=Inventory!A46,Inventory!B46:D46,IF(B:B=Inventory!A47,Inventory!B47:D47,IF(B:B=Inventory!A48,Inventory!B48:D48,IF(B:B=Inventory!A49,Inventory!B49:D49,IF(B:B=Inventory!A50,Inventory!B50:D50,IF(B:B=Inventory!A51,Inventory!B51:D51,IF(B:B=Inventory!A52,Inventory!B52:D52,IF(B:B=Inventory!A53,Inventory!B53:D53,IF(B:B=Inventory!A54,Inventory!B54:D54,IF(B:B=Inventory!A55,Inventory!B55:D55,IF(B:B=Inventory!A56,Inventory!B56:D56,IF(B:B=Inventory!A57,Inventory!B57:D57,IF(B:B=Inventory!A58,Inventory!B58:D58,IF(B:B=Inventory!A59,Inventory!B59:D59,IF(B:B=Inventory!A60,Inventory!B60:D60,IF(B:B=Inventory!A61,Inventory!B61:D61,IF(B:B=Inventory!A62,Inventory!B62:D62,IF(B:B=Inventory!A63,Inventory!B63:D63,IF(B:B=Inventory!A64,Inventory!B64:D64,IF(B:B=Inventory!A65,Inventory!B65:D65,IF(B:B=Inventory!A66,Inventory!B66:D66)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Looks like you should rethink your approach.
Maybe show here in a concise manner what you want to accomplish and there will be someone with a better approach.
 
Upvote 0
Welcome to the forum!

Clearly there is a better way to do it than a huge formula. If your Inventory sheet looks like this:

Book1
ABCD
1CodeVal1Val2Val3
2a1611
3b2712
4c3813
5d4914
6e51015
7
Inventory


You can do something like this:

Cell Formulas
RangeFormula
C2:E7C2=INDEX(Inventory!$B$2:$D$66,MATCH(B2,Inventory!$A$2:$A$66,0),0)
Press CTRL+SHIFT+ENTER to enter array formulas.


Much shorter formula. There are a couple of interesting points with your original formula. You're using B:B=Inventory!A2, which seems to indicate you're using implicit intersection. That has been reimagined in newer versions of Excel, and should be avoided. I just used the B2 value for matching. Then you're returning a 3-column result, so I put displayed that by selecting the 3 columns and using Control+Shift+Enter.

If this does not reflect what you want, please try to explain a bit clearer. If you use the XL2BB tool, like I just did, it's much easier to explain what you want. You can download it from my signature, or the response box. It's easy to download, install, and use.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,175
Members
453,021
Latest member
Justyna P

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