Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Excel IF func. to return closest make up

Options
  • 24-07-2010 1:53pm
    #1
    Registered Users Posts: 1


    This is one for all you genius maths brains out there..

    I'm looking to write a function that will return the closest make up of a height when i'm building it with set sized pieces...
    This is hard to explain but basically i have the option of a 1200mm length, 900mm length, 600mm length, 450mm length and a 300mm length and i want to make up say 3456:

    I have it simply set up to return, 1200 + 1200 + 900 remainder: 156 by giving me the largest possible length and reiterating

    but it would be better if it returned 450 + 1200 + 900 + 900 remainder: 6

    hope i explained it ok!
    Also if thats too easy i'd love it to give me the option of changing it, to give me two diff returns as 300mm lengths are proportionally v. expensive and i'd rather avoid them!

    Thanks


Comments

  • Registered Users Posts: 2,481 ✭✭✭Fremen


    Well, the first thing to notice is the fact that you have 1200s, 900s and 600s is in some sense "irrelevant" since they can all be made out of 300s and 450s.

    The first thing you should do when trying to solve a problem is reduce it to its simplest case. What would you do with just a 300 and a 450 length?

    Once you have a nice answer for that, you can swap out sets of 300s and 450s for bigger pieces.

    Another thing to notice: if a 300 is a "one", then a 450 is a "one and a half". So now what do you do?


Advertisement