+ Reply to Thread
Results 1 to 5 of 5

Count, add, discriminate and give me an answer

  1. #1
    Registered User
    Join Date
    04-14-2013
    Location
    Melbourne
    MS-Off Ver
    Excel 2010
    Posts
    6

    Smile Count, add, discriminate and give me an answer

    Hi

    I have no idea how to achieve my aim at the moment. Pointing it in the right direction might help.
    What I want to do is use Excel to work out the number of lengths of wood I require for a given number of pieces.
    EG (examples are in millimeters)If I have pieces of 2232, 549, 1700, 450, 908, 325 and the available lengths of timber are 2400, I want to test by

    addition the pieces which are as close as possible to 2400, place a count for the first set, then count the next lot of numbers etc.
    From my example I would expect to receive the answer 3.
    546+450+908+325=2142=1
    1700<2400=1
    2232<2400=1
    1+1+1=3

    I have been thinking about this for some time, have tried If and Sum in great long turgid equations like =IF($D$2>SUM(A3:A4),SUM(A3:A5),IF(SUM(A3:A5<

    $D$2),SUM(A3:A6),IF(SUM(A3:A6<$D$2),SUM(A3:A7)))) This works as far as it goes but it does not mark an cell as counted so using it in the next cell is

    pointless as it returns the same answer because it just counts the same stuff again.
    maybe this is better done in VB?

  2. #2
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Count, add, discriminate and give me an answer

    well it depends if you want to use the smallest first
    something like this maybe?
    Attached Files Attached Files
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  3. #3
    Registered User
    Join Date
    04-14-2013
    Location
    Melbourne
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Count, add, discriminate and give me an answer

    Hi Martin

    Thank you for your reply. I would test out what you have posted but I only get a PHP script rather than an XLS

    lawrie

  4. #4
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Count, add, discriminate and give me an answer

    ?????? i just downloaded it fine from my post,try another browser

  5. #5
    Registered User
    Join Date
    04-14-2013
    Location
    Melbourne
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Count, add, discriminate and give me an answer

    That is very cool Martin, I thank you for your help. I would have got there some time around 2020.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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