+ Reply to Thread
Results 1 to 5 of 5

Help in finding combinations

  1. #1
    Registered User
    Join Date
    10-22-2015
    Location
    Australia
    MS-Off Ver
    2013
    Posts
    2

    Help in finding combinations

    Hi every one I am new to this form and new to excel as well...
    I need some help hopping some one can help me out
    If a column lets say "A" has numbers ranging from 200 to 1200 I want to find out if any two or three combinations of numbers can find sum of 1200 or under... this is to maximize the sheet which is 1200 lets say if I have numbers like
    253
    256
    262
    265
    272
    280
    285
    290
    290
    300
    300
    302
    320
    321
    324
    325
    325
    325
    330
    340
    341
    345
    347
    352
    354
    355
    363
    370
    375
    375
    380
    385
    396
    406
    412
    420
    426
    428
    431
    431
    438
    440
    443
    450
    450
    454
    455
    455
    468
    470
    479
    484
    490
    490
    490
    490
    493
    506
    506
    518
    540
    558
    567
    569
    572
    591
    599
    599
    600
    600
    600
    600
    600
    600
    600
    601
    615
    615
    620
    621
    621
    625
    635
    638
    651
    652
    665
    667
    677
    687
    687
    694
    700
    710
    713
    716
    721
    722
    727
    742
    750
    750
    750
    750
    756
    777
    780
    780
    800
    810
    811
    813
    822
    822
    825
    835
    835
    836
    838
    848
    850
    850
    850
    850
    850
    850
    850
    850
    850
    850
    850
    850
    870
    870
    876
    880
    888
    888
    892
    896
    900
    915
    930
    938
    950
    950
    951
    957
    960
    960
    960
    961
    964
    971
    975
    995
    1000
    1010
    1010
    1010
    1010
    1010
    1010
    1012
    1021
    1040
    1048
    1065
    1069
    1082
    1085
    1085
    1099
    1104
    1110
    1116
    1140
    1140
    1153
    1159
    1163
    1176
    1179
    1200
    1200
    1200

    I need to find as much as higher number as possible as off now I am doing manually any help is greatly appreciated thank you

  2. #2
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,623

    Re: Help in finding combinations

    What would be the manual output for this data?
    1200 (one element)
    1200
    1200
    1179
    ...
    950
    950 (last single element)
    now pairs
    938 and 262 (to be exactly 1200) or may be 938 and 253
    ... more pairs
    ... then triples



    or may be other?
    Best Regards,

    Kaper

  3. #3
    Registered User
    Join Date
    10-22-2015
    Location
    Australia
    MS-Off Ver
    2013
    Posts
    2

    Re: Help in finding combinations

    Hi Kaper

    Firstly thank you for taking time out....
    Steps I am following manually is sort data highest to lowest and pair lowest number and highest number 360+800=1160, 500+700=1200 and so on trial and error. Ideally if I can see in a different column which two or three numbers to combine to maximize the output. Result should show me which numbers I need to pair to get anything in between 0 to 1200. Yea mostly pairs if more lower numbers are left out I am adding them up 250+300+212=762
    870 1
    321 1
    354 2
    836 2
    355 3
    835 3
    345 4
    412 4
    428 4
    896 5
    280 5
    341 6
    380 6
    406 6
    995 7
    960 8
    253 9
    320 9
    Thank you once again

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Help in finding combinations

    Make a table?

    Row\Col
    A
    B
    C
    D
    E
    F
    G
    H
    I
    J
    K
    L
    M
    N
    O
    P
    Q
    R
    S
    1
    253
    280
    320
    321
    341
    345
    354
    355
    380
    406
    412
    428
    835
    836
    870
    896
    960
    995
    2
    253
    3
    280
    533
    4
    320
    573
    600
    5
    321
    574
    601
    641
    6
    341
    594
    621
    661
    662
    7
    345
    598
    625
    665
    666
    686
    8
    354
    607
    634
    674
    675
    695
    699
    9
    355
    608
    635
    675
    676
    696
    700
    709
    10
    380
    633
    660
    700
    701
    721
    725
    734
    735
    11
    406
    659
    686
    726
    727
    747
    751
    760
    761
    786
    12
    412
    665
    692
    732
    733
    753
    757
    766
    767
    792
    818
    13
    428
    681
    708
    748
    749
    769
    773
    782
    783
    808
    834
    840
    14
    835
    1088
    1115
    1155
    1156
    1176
    1180
    1189
    1190
    1215
    1241
    1247
    1263
    15
    836
    1089
    1116
    1156
    1157
    1177
    1181
    1190
    1191
    1216
    1242
    1248
    1264
    1671
    16
    870
    1123
    1150
    1190
    1191
    1211
    1215
    1224
    1225
    1250
    1276
    1282
    1298
    1705
    1706
    17
    896
    1149
    1176
    1216
    1217
    1237
    1241
    1250
    1251
    1276
    1302
    1308
    1324
    1731
    1732
    1766
    18
    960
    1213
    1240
    1280
    1281
    1301
    1305
    1314
    1315
    1340
    1366
    1372
    1388
    1795
    1796
    1830
    1856
    19
    995
    1248
    1275
    1315
    1316
    1336
    1340
    1349
    1350
    1375
    1401
    1407
    1423
    1830
    1831
    1865
    1891
    1955


    In A2 and copy down and right,

    =IF(ROWS($A$1:B2) <= COLUMNS($A$1:B2), "", $A2+B$1)

    EDIT: Didn't notice Kaper was here. He'll get you sorted.
    Entia non sunt multiplicanda sine necessitate

  5. #5
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,623

    Re: Help in finding combinations

    Filling a bit called by name :-D
    Quote Originally Posted by shg View Post
    EDIT: Didn't notice Kaper was here. He'll get you sorted.
    Let me reuse one of my old codes, a bit adopted to current task.
    If we were to look for bigger subsets especialy more than some 5 may be 7 elements, I'd go for recursive approach but here, strightforward loops would be just fine.
    I think it is rather easy to follow (not so short but divided into simple sections, meaningfull variable names and even some comments too ).

    Please Login or Register  to view this content.
    Data starts in sheet1 cell A2
    output goes directly to sheet2
    We try to find perfectly fitted single values, pairs and triplets
    then we put less tension (say by 5) and try to find singles,pairs, triplets
    then again, and again until we canot be more tollerant.

    Try it and share your experience.
    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. Finding combinations of 8 letters
    By macaonghus in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-19-2015, 02:20 AM
  2. Function for finding SUM combinations
    By Kasper222 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-14-2014, 11:32 AM
  3. VBA - Finding unique combinations
    By xlsnovice in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-30-2013, 10:32 AM
  4. 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
  5. Finding unique combinations
    By jharaldson in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-10-2012, 11:40 AM
  6. Finding Combinations of a Three digit Number
    By darrylx in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 11-08-2011, 05:29 AM
  7. Finding combinations that add up to X
    By mj6987 in forum Excel General
    Replies: 4
    Last Post: 04-07-2006, 07:20 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