SOLVED

Issue with long nested IF formula (alternative way?)

%3CLINGO-SUB%20id%3D%22lingo-sub-2011523%22%20slang%3D%22en-US%22%3EIssue%20with%20long%20nested%20IF%20formula%20(alternative%20way%3F)%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2011523%22%20slang%3D%22en-US%22%3E%3CP%3EHi%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20seem%20to%20have%20an%20issue%20with%20a%20long%20IF%20formula%20I%20am%20trying%20to%20build.%20The%20formula%20itself%20works%2C%20but%20I%20think%20there%20could%20be%20a%20quicker%20and%20more%20clever%20way%20to%20achieve%20the%20same%20outcome.%20I'd%20like%20your%20help.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSTRONG%3EContext%3A%3C%2FSTRONG%3E%3C%2FP%3E%3CUL%3E%3CLI%3EA%20department%20can%20place%202%20orders%20for%20product%20A%3A%20Order%20%231%2C%20and%20Order%20%232.%3C%2FLI%3E%3CLI%3EDepending%20on%20their%20order%20quantity%2C%20the%20quantity%20of%20the%20components%20A1%2C%20A2%2C%20A3%2C%20etc.%20will%20be%20delivered.%3C%2FLI%3E%3CLI%3EThe%20sum%20of%20Order%201%20and%202%20gives%20the%20total%20(cumulative)%20order%20quantity.%3C%2FLI%3E%3CLI%3EThe%20IF%20function%20comes%20into%20play%20because%2C%20depending%20on%20the%201st%20and%202nd%20order%20quantity%2C%20the%20quantity%20of%20components%20dispatched%20will%20need%20to%20vary%20(the%20cumulative%20figure%20is%20very%20important%20because%20dictates%20how%20many%20pieces%20the%20department%20should%20receive%20for%20each%20component).%3C%2FLI%3E%3C%2FUL%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESee%20file%20attached.%20I%20have%20created%20a%20long%20and%20manual%20IF%20function%20in%20CELL%20B13%2C%20but%20I%20would%20like%20to%20understand%20if%20there%20is%20a%20better%20way%20to%20do%20that.%20Besides%2C%20my%20formula%20in%20B13%20does%20not%20take%20into%20account%20all%20possible%20scenarios%20because%20it'd%20be%20way%20too%20long.%20I%20am%20sure%20there%20should%20be%20another%20way%20but%20I%20can't%20think%20of%20it...%20I%20tried%20using%20IFS%20to%20make%20it%20shorter%2C%20but%20I%20don't%20have%20that%20function%20on%20MS%20Excel%202016.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAny%20suggestion%2Fhelp%3F%26nbsp%3BI%20am%20tagging%20you%20again%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F403176%22%20target%3D%22_blank%22%3E%40Riny_van_Eekelen%3C%2FA%3E%26nbsp%3Bjust%20in%20case%20you%20may%20be%20able%20to%20kindly%20help%20here.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThank%20you%20very%20much%2C%3C%2FP%3E%3CP%3ELuca%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2011523%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2011600%22%20slang%3D%22en-US%22%3ERe%3A%20Issue%20with%20long%20nested%20IF%20formula%20(alternative%20way%3F)%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2011600%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F909127%22%20target%3D%22_blank%22%3E%40Luca_Morrone91%3C%2FA%3E%26nbsp%3BThis%20is%20typically%20something%20that%20you%20can%20handle%20with%20INDEX%20and%20MATCH.%20See%20attached.%20Have%20used%20some%20named%20ranges%20to%20avoid%20long%2Fand%20absolute%20references%20in%20the%20formula.%20And%20by%20the%20way%2C%20I%20changed%20the%20headers%20on%20row%201%20to%20numbers%201%20through%2026%20in%20stead%20of%201st%2C%202nd%2C%203rd%20etc.%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-excel%22%3E%3CCODE%3E%3DINDEX(Quantities%2CMATCH(A16%2CProdDescr%2C0)%2CMATCH(%24B%2413%2CNbrOfOrders%2C0))-INDEX(Quantities%2CMATCH(A16%2CProdDescr%2C0)%2CMATCH(%24B%249%2CNbrOfOrders%2C0))%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Occasional Contributor

Hi,

 

I seem to have an issue with a long IF formula I am trying to build. The formula itself works, but I think there could be a quicker and more clever way to achieve the same outcome. I'd like your help.

 

Context:

  • A department can place 2 orders for product A: Order #1, and Order #2.
  • Depending on their order quantity, the quantity of the components A1, A2, A3, etc. will be delivered.
  • The sum of Order 1 and 2 gives the total (cumulative) order quantity.
  • The IF function comes into play because, depending on the 1st and 2nd order quantity, the quantity of components dispatched will need to vary (the cumulative figure is very important because dictates how many pieces the department should receive for each component).

 

See file attached. I have created long and manual IF functions in CELLS B16-B20 (B21 is separate), but I would like to understand if there is a better way to do that. Besides, my formulas in CELLS B16-B20 does not take into account all possible scenarios because it'd be way too long. I am sure there should be another way but I can't think of it... I tried using IFS to make it shorter, but I don't have that function on MS Excel 2016.

 

The inputs are on B9 an B11. And the outputs are in B13, B16-B20, B21.

 

Any suggestion/help? I am tagging you again @Riny_van_Eekelen just in case you may be able to kindly help here.

 

Thank you very much,

Luca

2 Replies
best response confirmed by Luca_Morrone91 (Occasional Contributor)
Solution

@Luca_Morrone91 This is typically something that you can handle with INDEX and MATCH. See attached. Have used some named ranges to avoid long/and absolute references in the formula. And by the way, I changed the headers on row 1 to numbers 1 through 26 in stead of 1st, 2nd, 3rd etc.

=INDEX(Quantities,MATCH(A16,ProdDescr,0),MATCH($B$13,NbrOfOrders,0))-INDEX(Quantities,MATCH(A16,ProdDescr,0),MATCH($B$9,NbrOfOrders,0))

 

wow, thanks Riny, that was quick. Truly appreciate your help