+ Reply to Thread
Results 1 to 5 of 5

nested if optimising

  1. #1
    Registered User
    Join Date
    06-09-2017
    Location
    germany
    MS-Off Ver
    2010
    Posts
    23

    nested if optimising

    good day all,

    i have been trying to crack this for a while now, but i cant seem to do it the file i have is to link how often we order with the lead time and keep a safety stock of a month and a half extra depending on the RC for example if its 1 then i have to keep 1.5 months extra, but if it is 2 then i have to keep 2.5 months extra. i also have to test this against the arriving month so i have 6 categories of RC and 6 categories of Lead time and testing all possibilities resulted in a 36 nested if statements to do it. i will attach the original formula (if u have time to read it) and a small test file , i hope you can help me out since excel is not allowing me to save the formula for it is more than 8K characters i had to save it as binary file.

    your help is much appreciated
    Attached Files Attached Files

  2. #2
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,150

    Re: nested if optimising

    Can you explain exactly what you want a revised formula to do. Your sample file should include some REPRESENTATIVE samples, along with manually calculated results. In your current sheet, I see a pile of 1s, little explanation and no indication of your expected (manually calculated) results.
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU

  3. #3
    Forum Expert José Augusto's Avatar
    Join Date
    10-29-2014
    Location
    Portugal
    MS-Off Ver
    2013-2016
    Posts
    3,329

    Re: nested if optimising

    Hi George

    I have many doubts (almost as many as the docx lines). I'll try to systematize just a few:

    1) The stock averages for each month are in adjacent and ordered columns, ie [@ [avg cogs jan]]: [@ [avg cogs dec]]?
    2) When [@ [Review Cycle]] = 4 the formula presents 2 distinct methods for each [@ receiving month]]. Do you want the highest of values?
    3) In the last part of your formula, the "if" referring [@ Review Cycle] = 6 seems to contain the "else" part which makes me think if [@ Cycle Review] can be greater than 6. It is true?

    See the formula:
    Please Login or Register  to view this content.

  4. #4
    Forum Expert
    Join Date
    10-09-2014
    Location
    Newcastle, England
    MS-Off Ver
    2003 & 2013
    Posts
    1,986

    Re: nested if optimising

    I think there can be quite a bit optimised here by totally changing around he way the IFs are done.

    For example all of the Month 3 and 4 items are along the same lines for the 1st 4 Review Cycles so as I see it you could lump them in one IF statement

    The difference is in the [Review Cycle] which, in each iteration moves forward in the months included, this is the formula for [Review Cycle =1, receiving_month = 3]
    Please Login or Register  to view this content.
    And heres the [Review Cycle = 4] for month = 3
    Please Login or Register  to view this content.
    The difference is the number of months added at the start and the number you add relates to the Review Cycle.
    So at the worst you could say

    Please Login or Register  to view this content.
    Then do the same sort of thing for month 4, this will condense 8 IF statements into 2.
    If someone has helped you then please add to their Reputation

  5. #5
    Registered User
    Join Date
    06-09-2017
    Location
    germany
    MS-Off Ver
    2010
    Posts
    23

    Re: nested if optimising

    IF (Review Cycle] < 5),
    IF([receiving_month] =3, [@[avg cogs mar] + [avg cogs apr] +(IF[Review Cycle] > 1,[avg cogs may], 0) + (IF[Review Cycle] > 2,[avg cogs jun],0) + (IF[Review Cycle] > 3,[avg cogs jul],0) +0.5*[LOOKUP([Review Cycle],{2,3,4},{[avg cogs may], [avg cogs jun], [avg cogs jul]}-([@[7th of jan stock value -drp str and reserved]]-(LOOKUP([Review Cycle],{1,2,3,4},{[@[avg cogs jan]]-[@[avg cogs feb]], [@[avg cogs jan]]-[@[avg cogs feb]], [@[avg cogs jmar]]-[@[avg cogs apr], [@[avg cogs jan]]-[@[avg cogs feb]])



    i think this is exactly what i want, thank you very much

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. optimising formulas
    By Trebor777 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 08-06-2017, 08:54 AM
  2. Help optimising my code
    By DanielPodo in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-31-2017, 10:33 AM
  3. [SOLVED] Optimising code
    By Gti182 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-10-2012, 11:44 AM
  4. Optimising code
    By mpower87 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-31-2011, 11:49 PM
  5. Optimising with Formula
    By andrewc in forum Excel General
    Replies: 0
    Last Post: 06-17-2010, 07:46 AM
  6. optimising this VBA
    By brave.inf in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-12-2009, 09:44 AM
  7. [SOLVED] Help with optimising code
    By FrigidDigit in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-20-2005, 11:05 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1