SOLVED

Struggling with Nested formula

%3CLINGO-SUB%20id%3D%22lingo-sub-2947211%22%20slang%3D%22en-US%22%3EStruggling%20with%20Nested%20formula%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2947211%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20does%20anyone%20know%20how%20I%20would%20write%20this%20Formula%3A%3C%2FP%3E%3CP%3Ein%20column%20AP%20I'm%20trying%20to%20get%20the%20relevant%20category%20for%20that%20cell%20from%20my%20%22reference%20table%22%20column%20G.%3C%2FP%3E%3CP%3EI%20want%20to%20use%20the%20criteria%20for%20columns%20AJ%2C%20AM%2C%20AN%2C%20AO%20then%20use%20these%20values%20against%20my%20reference%20table%20to%20see%20which%20category%20it%20falls%20into.%20I%20want%20to%20be%20able%20to%20use%20all%20the%20categories%20in%20column%20G%20from%20the%20reference%20table.%3C%2FP%3E%3CP%3EI%20know%20its%20something%20like%20a%20nested%20formula%20i%20would%20use%20but%20really%20struggling%20with%20how%20to%20structure%20this%20formula.%20I've%20attached%20the%20file%20I'm%20referring%20to%2C%20any%20guidance%20would%20be%20much%20appreciated.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThank%20you%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2947211%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2947257%22%20slang%3D%22en-US%22%3ERe%3A%20Struggling%20with%20Nested%20formula%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2947257%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1163132%22%20target%3D%22_blank%22%3E%40excel_learner%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3DVLOOKUP(%5B%40Material5%5D%26amp%3B%5B%40Diameter2%5D%26amp%3B%5B%40Tier4%5D%2CCHOOSE(%7B1%2C2%7D%2C'Reference%20Table'!%24C%242%3A%24C%2444%26amp%3B'Reference%20Table'!%24E%242%3A%24E%2444%2C'Reference%20Table'!%24G%242%3A%24G%2444)%2C2%2CFALSE)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThis%20is%20the%20formula%20i%20entered%20in%20your%20workbook.%20I%20have%20to%20enter%20formula%20as%20arrayformula%20with%20ctrl%2Bshift%2Benter%20as%20i%20don't%20work%20with%20Office365%20or%202021.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHowever%20i%20can't%20include%20criteria%20of%20column%20AM%20(Policy%20%2F%20No%20Policy)%20in%20the%20criteria%20range%20as%20there%20is%20no%20correponding%20column%20in%20the%20Reference%20Table.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2947446%22%20slang%3D%22en-US%22%3ERe%3A%20Struggling%20with%20Nested%20formula%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2947446%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1163132%22%20target%3D%22_blank%22%3E%40excel_learner%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3DIF(%5B%40Tier4%5D%3D'Reference%20Table'!%24E%2444%2C'Reference%20Table'!%24G%2444%2CIF(AND(%5B%40Tier4%5D%3D'Reference%20Table'!%24E%2442%2C%5B%40Policy%5D%3D'Reference%20Table'!%24F%2442)%2C'Reference%20Table'!%24G%2442%2CIF(AND(%5B%40Tier4%5D%3D'Reference%20Table'!%24E%2443%2C%5B%40Policy%5D%3D'Reference%20Table'!%24F%2443)%2C'Reference%20Table'!%24G%2443%2CVLOOKUP(%5B%40Material5%5D%26amp%3B%5B%40Diameter2%5D%26amp%3B%5B%40Tier4%5D%2CCHOOSE(%7B1%2C2%7D%2C'Reference%20Table'!%24C%242%3A%24C%2444%26amp%3B'Reference%20Table'!%24E%242%3A%24E%2444%2C'Reference%20Table'!%24G%242%3A%24G%2444)%2C2%2CFALSE))))%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20entered%20this%20formula%20and%20it%20seems%20to%20work%20now.%20Unfortunately%20i%20overlooked%20the%20entries%20for%20the%202%20categories%20for%20Policy%20in%20the%20beginning.%20In%20the%20Reference%20Table%20i%20had%20to%20change%20%22%20%26lt%3B%3D3%22%20%22%20to%20%22%26lt%3B%3D3%E2%80%9D%20%22%20(delete%20space%20in%20the%20beginning%20and%20switch%20%22%20to%26nbsp%3B%E2%80%9D)%20to%20make%20the%20adjusted%20formula%20work%20for%20these%20entries%20as%20well.%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2947693%22%20slang%3D%22en-US%22%3ERe%3A%20Struggling%20with%20Nested%20formula%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2947693%22%20slang%3D%22en-US%22%3EThank%20you%20so%20much.%3CBR%20%2F%3EWhat%20is%20your%20thought%20process%20when%20tackling%20this%20task%2C%20it%20would%20help%20me%20massively%20to%20know%20the%20best%20ways%20to%20go%20about%20these%20nested%20formulas.%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2947282%22%20slang%3D%22en-US%22%3ERe%3A%20Struggling%20with%20Nested%20formula%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2947282%22%20slang%3D%22en-US%22%3EThanks%20for%20your%20help%3CBR%20%2F%3EI%20only%20have%20Policy%20criteria%20for%202%20categories%20in%20the%20reference%20table.%20T2A%20and%20T2B%20in%20column%20G%20of%20the%20reference%20table.%20Is%20there%20a%20problem%20with%20that%20layout.%3CBR%20%2F%3EAlso%20I%20was%20assuming%20there's%20shouldn't%20be%20any%20%23N%2FA%20as%20all%20categories%20on%20reference%20table%20are%20covered%20for%20the%20criteria%20required.%20Do%20you%20know%20why%20there%20would%20be%20%23N%2FA%20%3F%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2948053%22%20slang%3D%22en-US%22%3ERe%3A%20Struggling%20with%20Nested%20formula%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2948053%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1163132%22%20target%3D%22_blank%22%3E%40excel_learner%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20start%20with%20a%20simple%20IF%20statement.%20Then%20I%20add%20one%20statement%20at%20a%20time%20as%20shown%20in%20the%20attached%20example%20file.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIf%20you%20work%20with%20Office365%20or%202021%20you%20can%20use%20IFS%20instead%20of%20IF.%20The%20syntax%20of%20IFS%20is%20easier%20than%20the%20syntax%20of%20IF.%20However%20i%20do%20only%20nest%20formulas%20if%20it's%20necessary.%20Sometimes%20VLOOKUP%20(or%20XLOOKUP....)%20can%20be%20applied%20instead%20of%20a%20nested%20formula%20or%20it%20might%20be%20possible%20to%20use%20Power%20Query.%3C%2FP%3E%3C%2FLINGO-BODY%3E
Contributor

Hi does anyone know how I would write this Formula:

in column AP I'm trying to get the relevant category for that cell from my "reference table" column G.

I want to use the criteria for columns AJ, AM, AN, AO then use these values against my reference table to see which category it falls into. I want to be able to use all the categories in column G from the reference table.

I know its something like a nested formula i would use but really struggling with how to structure this formula. I've attached the file I'm referring to, any guidance would be much appreciated.

 

Thank you

 

5 Replies

@excel_learner 

=VLOOKUP([@Material5]&[@Diameter2]&[@Tier4],CHOOSE({1,2},'Reference Table'!$C$2:$C$44&'Reference Table'!$E$2:$E$44,'Reference Table'!$G$2:$G$44),2,FALSE)

 

This is the formula i entered in your workbook. I have to enter formula as arrayformula with ctrl+shift+enter as i don't work with Office365 or 2021.

 

However i can't include criteria of column AM (Policy / No Policy) in the criteria range as there is no correponding column in the Reference Table.

Thanks for your help
I only have Policy criteria for 2 categories in the reference table. T2A and T2B in column G of the reference table. Is there a problem with that layout.
Also I was assuming there's shouldn't be any #N/A as all categories on reference table are covered for the criteria required. Do you know why there would be #N/A ?
best response confirmed by excel_learner (Contributor)
Solution

@excel_learner 

=IF([@Tier4]='Reference Table'!$E$44,'Reference Table'!$G$44,IF(AND([@Tier4]='Reference Table'!$E$42,[@Policy]='Reference Table'!$F$42),'Reference Table'!$G$42,IF(AND([@Tier4]='Reference Table'!$E$43,[@Policy]='Reference Table'!$F$43),'Reference Table'!$G$43,VLOOKUP([@Material5]&[@Diameter2]&[@Tier4],CHOOSE({1,2},'Reference Table'!$C$2:$C$44&'Reference Table'!$E$2:$E$44,'Reference Table'!$G$2:$G$44),2,FALSE))))

 

I entered this formula and it seems to work now. Unfortunately i overlooked the entries for the 2 categories for Policy in the beginning. In the Reference Table i had to change " <=3" " to "<=3” " (delete space in the beginning and switch " to ”) to make the adjusted formula work for these entries as well. 

Thank you so much.
What is your thought process when tackling this task, it would help me massively to know the best ways to go about these nested formulas.

@excel_learner 

I start with a simple IF statement. Then I add one statement at a time as shown in the attached example file.

 

If you work with Office365 or 2021 you can use IFS instead of IF. The syntax of IFS is easier than the syntax of IF. However i do only nest formulas if it's necessary. Sometimes VLOOKUP (or XLOOKUP....) can be applied instead of a nested formula or it might be possible to use Power Query.