Nested IF, AND Functions Limit Reached. Are there any alternatives?

stannard3

New Member
Joined
Sep 16, 2022
Messages
4
Office Version
  1. 365
Platform
  1. Windows
Hi,

I am new to Excel. I have been creating a formula combining the IF,AND functions and have just found out that there is a limit to the number of nested formulas.
I still have a lot of criteria to enter so are there any alternatives I can use?

I have attached a screenshot of where I am currently at in a particular cell and seem to have reached a limit. I am new to this so I'm sure there would have been a better way of doing this.

Any help would be greatly appreciated.

Thank you!
 

Attachments

  • Excel Formula.png
    Excel Formula.png
    125.4 KB · Views: 21

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
how many versions are there
group all the results together - so all 2's and 3's
then use a AND() and OR() together

so for 2 you have common things , so a true result only appears once -

like this - from what i can see this is all the 2's

IF( AND( A19="1 line base ", OR( B12 = "shaker", B12="Prestige", B12="chalreston") ) , 2 ,IF ( now group for the 3 , 4 5 6 etc

that would be a nested 8

maybe other ways - but its difficult to see images etc

Note: Images are difficult to see , and also requires that I input all the data myself, which is very time consuming.

A SMALL sample spreadsheet, around 10-20 rows, would help a lot here, with all sensitive data removed, and expected results mocked up and manually entered, with a few notes of explanation.

MrExcel has a tool called “XL2BB” that lets you post samples of your data and will allow us to copy/paste your sample data into our Excel spreadsheets, saving a lot of time.

You can also test to see if it works ok, in the "Test Here" forum.

OR if you cannot get XL2BB to work, or have restrictions on your PC , then put the sample spreadsheet onto a share
I only tend to goto OneDrive, Dropbox or google docs , as I'm never certain of other random share sites and possible virus.
Please make sure you have a representative data sample and also that the data has been desensitised, remember this site is open to anyone with internet access to see - so any sensitive / personal data should be removed
 
Upvote 0
Another option might be a lookup table. It's not as simple when you have more than 2 sets of criteria to work with but it could be possible.

In order to help you set one up, I would need the following information.

List of options for B12
List of options for A19
List of options for B14

If your attempted formula contains all options (and if you still have it), then copying that and pasting it to the forum will give me all of the info that I need.

It might be a bit harder to set up initially but a lookup table would be easier to maintain than a nested formula if and when any changes are needed.
 
Upvote 0
Another option might be a lookup table. It's not as simple when you have more than 2 sets of criteria to work with but it could be possible.

In order to help you set one up, I would need the following information.

List of options for B12
List of options for A19
List of options for B14

If your attempted formula contains all options (and if you still have it), then copying that and pasting it to the forum will give me all of the info that I need.

It might be a bit harder to set up initially but a lookup table would be easier to maintain than a nested formula if and when any changes are needed.
Thank you for replying! That is a worry I had about the changes required as this document will constantly be updated and evolved.

That sounds great thank you. The formula in the image I posted is about half of the formula I would have needed. Essentially I was working through each Cabinet Type (Cell A19) and creating the criteria needed for each Door Style (Cell B12) and Door Split (Cell B14). I was currently about half way through the Cabinet Types.

See below list of the options for each cell you asked for:

A19 :
1 DOOR HIGH LINE BASE
2 DOOR HIGH LINE BASE
2 DOOR NORWEGIAN CORNER BASE
1 DOOR/1 DRAWER BASE
2 DOOR/1 DRAWER BASE
2 DOOR/2 DRAWER BASE
2 DRAWER BASE
3 DRAWER BASE
5 DRAWER BASE
FIXED DOOR/PANEL
1 DOOR TOWER
2 DOOR TOWER
1 DOOR COUNTER TOP
2 DOOR COUNTER TOP
3 DOOR COUNTER TOP
4 DOOR COUNTER TOP
1 DOOR COUNTER TOP - NBR
2 DOOR COUNTER TOP - NBR
3 DOOR COUNTER TOP - NBR
4 DOOR COUNTER TOP - NBR
1 DOOR WALL
2 DOOR WALL
2 DOOR NORWEGIAN CORNER WALL
1 DOOR TOP BOX
2 DOOR TOP BOX

B12:
SHAKER
SLAB
PRESTIGE
CHARLSTON

B14:
1 PANEL
50/50
25/50/25
33/33/33
70/30
LINE THROUGH

Thanks for your help!
 
Upvote 0
how many versions are there
group all the results together - so all 2's and 3's
then use a AND() and OR() together

so for 2 you have common things , so a true result only appears once -

like this - from what i can see this is all the 2's

IF( AND( A19="1 line base ", OR( B12 = "shaker", B12="Prestige", B12="chalreston") ) , 2 ,IF ( now group for the 3 , 4 5 6 etc

that would be a nested 8

maybe other ways - but its difficult to see images etc

Note: Images are difficult to see , and also requires that I input all the data myself, which is very time consuming.

A SMALL sample spreadsheet, around 10-20 rows, would help a lot here, with all sensitive data removed, and expected results mocked up and manually entered, with a few notes of explanation.

MrExcel has a tool called “XL2BB” that lets you post samples of your data and will allow us to copy/paste your sample data into our Excel spreadsheets, saving a lot of time.

You can also test to see if it works ok, in the "Test Here" forum.

OR if you cannot get XL2BB to work, or have restrictions on your PC , then put the sample spreadsheet onto a share
I only tend to goto OneDrive, Dropbox or google docs , as I'm never certain of other random share sites and possible virus.
Please make sure you have a representative data sample and also that the data has been desensitised, remember this site is open to anyone with internet access to see - so any sensitive / personal data should be removed
Thanks for replying! That makes sense about grouping the criteria by the result I need rather than the criteria. I will give that if the lookup table does not work.

Thank you!
 
Upvote 0
the lookup table is the way to go and could even just use a countifs() , so A19 seems to be the number determinator - and so the others B12 and B14 does not change the number at all

then maybe a lookup just for A19 might work - I'll leave for now with jasonb75
but happy to make up something for you , if no reply

And it appears the number only goes up to 5 - yet you had the number 8 in the sample, i seem to remember "door tower" - is that the complete list
 
Upvote 0
I'm a bit pressed for time today so I've been putting something together quickly while I was waiting on your reply. I think that I've managed to get everything in from the formula in your screen capture but my eyes are starting to spin a bit reading it so anything is possible.

I've added the table to the side of the sheet for reference, but to keep things tidy it is often preferred to have the table on another sheet (which can be hidden if desired).

The results for the combinations go in the yellow part of the table, for combinations that don't exist, you can leave it blank (the formula will return 0).
It consists of 4 columns, 1 for each possible entry in B12

Column H contains the options for A19, followed by the paired options for A19 and B14 spanning columns G and H (the visual in the sheet will probably make more sense than my attempt to explain).

Given that each combination in the table will be unique, we can use a sum function to pull the required result from the cell (this is a lot easier to do with numbers than it is with text).

Moving on to the formula, the INDEX(MATCH( part of it identifies the correct column of results based on the selection in B12. Then SUMIFS uses the selections in A19 and B14 to find the value in the correct row.

I'm going to be away from the forum (or at least away from my laptop) in about an hour and won't be back to it for a few days. @etaf, would you be able to assist with any follow up questions please? I can respond to basics from my phone, but code and formulas are near impossible.

Stannard3.xlsx
ABCDEFGHIJKL
1ShakerPrestigeCharlstonSlab
21 Door High Line Base222
32 Door High Line Base444
42 Door Norwegian Corner Base333
51 Door/1 Drawer Base
62 Door/1 Drawer Base
72 Door/2 Drawer Base
82 Drawer Base
93 Drawer Base
101 PanelFixed Door/Panel
1150/50Fixed Door/Panel
12Charlston25/50/25Fixed Door/Panel
1333/33/33Fixed Door/Panel
1470/3070/30Fixed Door/Panel
15Line ThroughFixed Door/Panel
161 Panel1 Door Tower
1750/501 Door Tower
1825/50/251 Door Tower
192 Door TowerResult >>1234533/33/331 Door Tower
2070/301 Door Tower
21Line Through1 Door Tower
221 Panel2 Door Tower
2350/502 Door Tower
2425/50/252 Door Tower
2533/33/332 Door Tower
2670/302 Door Tower12345
27Line Through2 Door Tower
Sheet1
Cell Formulas
RangeFormula
E19E19=SUMIFS(INDEX($I$2:$L$27,0,MATCH(B12,$I$1:$L$1,0)),$H$2:$H$27,A19,$G$2:$G$27,B14&"")
 
Upvote 0
would you be able to assist with any follow up questions please?
of course , I think this may just be a simple lookup from A19 - but await the OP reply to my questions in last post
 
Upvote 0
I'm a bit pressed for time today so I've been putting something together quickly while I was waiting on your reply. I think that I've managed to get everything in from the formula in your screen capture but my eyes are starting to spin a bit reading it so anything is possible.

I've added the table to the side of the sheet for reference, but to keep things tidy it is often preferred to have the table on another sheet (which can be hidden if desired).

The results for the combinations go in the yellow part of the table, for combinations that don't exist, you can leave it blank (the formula will return 0).
It consists of 4 columns, 1 for each possible entry in B12

Column H contains the options for A19, followed by the paired options for A19 and B14 spanning columns G and H (the visual in the sheet will probably make more sense than my attempt to explain).

Given that each combination in the table will be unique, we can use a sum function to pull the required result from the cell (this is a lot easier to do with numbers than it is with text).

Moving on to the formula, the INDEX(MATCH( part of it identifies the correct column of results based on the selection in B12. Then SUMIFS uses the selections in A19 and B14 to find the value in the correct row.

I'm going to be away from the forum (or at least away from my laptop) in about an hour and won't be back to it for a few days. @etaf, would you be able to assist with any follow up questions please? I can respond to basics from my phone, but code and formulas are near impossible.

Stannard3.xlsx
ABCDEFGHIJKL
1ShakerPrestigeCharlstonSlab
21 Door High Line Base222
32 Door High Line Base444
42 Door Norwegian Corner Base333
51 Door/1 Drawer Base
62 Door/1 Drawer Base
72 Door/2 Drawer Base
82 Drawer Base
93 Drawer Base
101 PanelFixed Door/Panel
1150/50Fixed Door/Panel
12Charlston25/50/25Fixed Door/Panel
1333/33/33Fixed Door/Panel
1470/3070/30Fixed Door/Panel
15Line ThroughFixed Door/Panel
161 Panel1 Door Tower
1750/501 Door Tower
1825/50/251 Door Tower
192 Door TowerResult >>1234533/33/331 Door Tower
2070/301 Door Tower
21Line Through1 Door Tower
221 Panel2 Door Tower
2350/502 Door Tower
2425/50/252 Door Tower
2533/33/332 Door Tower
2670/302 Door Tower12345
27Line Through2 Door Tower
Sheet1
Cell Formulas
RangeFormula
E19E19=SUMIFS(INDEX($I$2:$L$27,0,MATCH(B12,$I$1:$L$1,0)),$H$2:$H$27,A19,$G$2:$G$27,B14&"")
Hi Both!,

Thank you so much! That looks like it is going to work. I will get a chance to test this properly later this afternoon and let you know how it comes out.
Presumably I can use this for other cells where I need to do a particular calculation depending on the cabinet type a d door style etc. I guess this would also work by changing the yellow boxes to the relevant formula.

I am also going to be away until later this afternoon but Thanks again @etaf and @jasonb75
 
Upvote 0

Forum statistics

Threads
1,215,353
Messages
6,124,458
Members
449,161
Latest member
NHOJ

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