+ Reply to Thread
Results 1 to 11 of 11

Need professional help with combinations

  1. #1
    Registered User
    Join Date
    08-08-2019
    Location
    Hamburg, Germany
    MS-Off Ver
    2019
    Posts
    4

    Need professional help with combinations

    hello all,

    I really hope that you can help me out. I need an excel calculation list that can do the following thing:

    In the column A (A2-A100) somebody types in several lenghts, eg 1969, 928, 456, 518 etc.

    - Fist the program subtracts 2x175 from the lenghts in A and gives back the result in column B (B2-B100).
    - Then the Program calculates which combinations of the lenghts 490, 290, 190, 90, 60 fit in to the lenghts in column B, prefering the longest to the shortest in regard to that the amount of the space that remains devided by (the number of units that was used +1) is >0 and <=100.


    Eg:

    A2-A100
    length
    1969
    928
    1331

    B2-B100
    lenght-2x175
    1619
    578
    981

    C2-C100
    test 490
    3
    1
    1

    D2-D100
    test 290
    0
    0
    1

    E2-E100
    test 190
    0
    0
    0

    F2-F100
    test 90
    0
    0
    1

    G2-G100
    test 60
    0
    0
    0

    H2-H100
    amount remains
    149 (=1619-3x490-0x290-0x190-0x90-0x60)
    88 (=578-1x490-0x290-0x190-0x90-0x60)
    111 (=981-1x490-1x290-1x90-0x90-0x60)

    I2-I100
    devided by used parts (space between the test parts)
    37,25 (=149/(1+ 3+0+0+0+0)) <---- 37,25 is >0 and <=100.
    44 (=88/(1+ 1+0+0+0+0)) <---- 44 is >0 and <=100.
    27,75 (=111/(1+ 1+1+0+1+0)) <---- 27,75 is >0 and <=100.



    I did already an excel table that calculates the "lenght-2x175" in the beackground, the "amount remains" and the "devided by used parts". But i need to test all lenghts (490,290,190,90,60) manually if they fit. And this is where i need your help. actually i would like to only give excel the lenghts in A and he calculates everything automatically.

    can you please help me out?

    thank you so much in advance!


  2. #2
    Valued Forum Contributor
    Join Date
    12-28-2014
    Location
    NSW, Australia
    MS-Off Ver
    MS365
    Posts
    604

    Re: Need professional help with combinations

    I got different answers to you, but hopefully it'll work.

    Edit: My formulas just use simple math to calculate the remaining length at each column including H.
    kvsrinivasamurthy's sumproduct formula is much more elegant.

    Column B simply deducted the required 2 x 175 from column A
    Please Login or Register  to view this content.
    Column C calculates the number of 490's that will fit in the remaining length
    Please Login or Register  to view this content.
    In this example of 1969mm less 2 x 175, B2/490 would equal 3.30408. The command INT removes any decimals returning just the "3".

    Column D calculates the number of 290's that will fit in the new remaining length
    Please Login or Register  to view this content.
    Column E calculates the number of 190's that will fit in the new remaining length
    Please Login or Register  to view this content.
    Column F calculates the number of 90's that will fit in the new remaining length
    Please Login or Register  to view this content.
    Column G calculates the number of 60's that will fit in the new remaining length
    Please Login or Register  to view this content.
    Column H calculates the final remaining length.
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by Beamernsw; 08-12-2019 at 09:06 AM.

  3. #3
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2406 (Windows 11 23H2 64-bit)
    Posts
    81,483

    Re: Need professional help with combinations

    Sorry for off-topic interjection:

    Although there is no official rule regarding this behaviour, we request that wherever possible both the question AND the answer be provided in substantive detail here within the thread. An attached workbook is an excellent aid for posing a question and offering a solution, but solely doing that with no in thread explanation makes it difficult for researchers to understand or consider the Q & A of this thread without downloading what may be a pointless doc to them, if they can do that at all. Doing that also hides the content from search engines so others may never benefit from this.

    I'm sure you understand.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  4. #4
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,628

    Re: Need professional help with combinations

    Pl see file.
    In B2 then copied down
    Please Login or Register  to view this content.
    In C2 then copied down till Column H
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Pl note
    Array formula should be confirmed with Ctrl+Shift+Enter keys together.
    If answere is satisfactory press * to add reputation.

  5. #5
    Registered User
    Join Date
    08-08-2019
    Location
    Hamburg, Germany
    MS-Off Ver
    2019
    Posts
    4
    Hello and thank you for your help so far. I made some changes to the table.
    Where I still need your help is the idea how to manage that the calculation guidelines are based on that the "gap output" has to be >10 and <=100. do you have an idea how to manage that?

    Thank you for the help
    Attached Files Attached Files
    Last edited by AliGW; 08-12-2019 at 05:25 AM. Reason: Please don't quote unnecessarily!

  6. #6
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2406 (Windows 11 23H2 64-bit)
    Posts
    81,483

    Re: Need professional help with combinations

    My formulas just use simple math to calculate the remaining length at each column including H.
    This is not satisfactory as an explanation of your proposed solution. You should provide the formulae used and state in which cells they should go in the body of your post, please.

  7. #7
    Valued Forum Contributor
    Join Date
    12-28-2014
    Location
    NSW, Australia
    MS-Off Ver
    MS365
    Posts
    604

    Re: Need professional help with combinations

    I think the simplest idea would be to change your measurements in Row 2. Make B2=180, C2=500, D2=300..etc..G2=75.
    Gap output formula for Cell I3 would be:-
    Please Login or Register  to view this content.
    If you need your original numbers shown in the cells instead of changing them as I described, then insert a new Row between Row 1 and Row 2. Then copy the cells from the old Row 2 to into the new Row 2. Then change the numbers in the new Row 3 (old Row 2) to the ones I suggested and then hide that row.

  8. #8
    Registered User
    Join Date
    08-08-2019
    Location
    Hamburg, Germany
    MS-Off Ver
    2019
    Posts
    4

    Re: Need professional help with combinations

    hello and thank you for the help, but unforunately this doesnt solve the problem.

    I input a lenght, eg. 2000 mm. the programm calculates on the basis, deviding this lenght by the parts, eg. 490 which is brilliant. but now i need a loop so that the result gets verified: eg.

    1) 2000 mm - 2x175 mm = 1650 mm as my test lenght.
    2) INT(1650/490) = 3
    3) INT((1650-3*490)/310) = 0
    4) INT((1650-3*490-0*310)/190) ) = 0
    5) INT((1650-3*490-0*310-0*190)/155) = 1
    6) INT((1650-3*490-0*310-0*190-1*155)/65) = 0

    Output:
    7) 1650-3*490-0*310-0*190-1*155-0*65 = 25

    Gap:
    8) 25/(1+ 3+0+0+1+0) = 5

    And here i need the loop because 5 is below 10. And the result in the gap needs to be above 10.

    I hope that you can help me!

  9. #9
    Valued Forum Contributor
    Join Date
    12-28-2014
    Location
    NSW, Australia
    MS-Off Ver
    MS365
    Posts
    604

    Re: Need professional help with combinations

    If you did what I suggested in my last post, I think you'd find that it does work.
    Here's you're last sheet with the changes I suggested along with the length changes you added.
    If you wish to see row 3, then select rows 2 to 4, right click, select unhide.
    Attached Files Attached Files

  10. #10
    Registered User
    Join Date
    08-08-2019
    Location
    Hamburg, Germany
    MS-Off Ver
    2019
    Posts
    4

    Re: Need professional help with combinations

    Hello, unfortunately the calculation is wrong in your table.

    if i eg input 1969, i get 2x175,3x490 and 1x65. space 34 and gap 16,8. BUT. 1969-2x175 is 1619. 1619-3x490-1x65 is 84, not 34, so space is wrong. and gap is 16,8.

  11. #11
    Valued Forum Contributor
    Join Date
    12-28-2014
    Location
    NSW, Australia
    MS-Off Ver
    MS365
    Posts
    604

    Re: Need professional help with combinations

    Sorry, you are absolutely right. I forgot to add in the 10mm gaps that I allowed for each piece. Modified formulas in H and I should fix it I hope
    Attached Files Attached Files

+ 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. Replies: 1
    Last Post: 01-31-2016, 07:46 AM
  2. Professional Newbie
    By jetblue71 in forum Hello..Introduce yourself
    Replies: 1
    Last Post: 04-25-2013, 05:39 AM
  3. Finding possible combinations & listing the wanted combinations
    By Zoke in forum Excel Programming / VBA / Macros
    Replies: 30
    Last Post: 07-16-2012, 03:41 PM
  4. Need Professional Correction
    By yiannis1925 in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 12-09-2011, 10:03 AM
  5. HOW CAN I FIX MY PHOTO'S TO LOOK PROFESSIONAL?
    By Beegee in forum Excel General
    Replies: 1
    Last Post: 05-07-2006, 04:45 AM
  6. [SOLVED] excel professional
    By bcascio in forum Excel General
    Replies: 1
    Last Post: 02-11-2006, 03:10 PM
  7. [SOLVED] MS OfficeXP Professional
    By Herman in forum Excel General
    Replies: 7
    Last Post: 04-24-2005, 12:06 PM

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