+ Reply to Thread
Results 1 to 3 of 3

VBA: Combination with exact repetitions

  1. #1
    Registered User
    Join Date
    02-25-2021
    Location
    Bitola, Macedonia
    MS-Off Ver
    2016
    Posts
    2

    VBA: Combination with exact repetitions

    Hello all


    I am struggling with some code that I want to write. Can somebody help me?

    In the table below in column C I have some numbers, in column D is how many times I have that number in C.
    the rows can be more than 1000 rows.

    column C values I store in C(x) and column D values I stored in D(x) memory

    I need all combinations of sums of the values in C but the sum to be equal or less to value 20. To use all the values of C and to do not exceed D number of times value of C is used.

    exp. 2+2+2+2+2+3.3+3.3+3.3=19.9
    those 2*5 and 3,3*3 because we used to do not repeat

    The point is to get the best combination

    c d
    length m` pieces
    1.60 3
    2.10 4
    5.65 12
    3.30 4
    5.55 3
    3.83 22
    4.45 6
    2.63 2
    0.60 34
    1.02 21
    . .
    . .

  2. #2
    Registered User
    Join Date
    02-25-2021
    Location
    Bitola, Macedonia
    MS-Off Ver
    2016
    Posts
    2

    Re: VBA: Combination with exact repetitions

    Attachment 720784

    Sorry for the table

  3. #3
    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,613

    Re: VBA: Combination with exact repetitions

    I got a message: Invalid Attachment specified.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.

    If you described it right, so there couls be data in C1:D1000 then the time to get THE best solution would be incredibly long (years or more). But you may try to look for good solution setting allowable time limit.

    See also good discussion in similar thread: https://www.excelforum.com/excel-pro...th-orders.html
    Best Regards,

    Kaper

+ 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. [SOLVED] Analyzing repetitions of numbers and more
    By bansche123 in forum Excel Formulas & Functions
    Replies: 17
    Last Post: 12-02-2019, 03:46 PM
  2. Number of repetitions in a collumn and counting those repetitions
    By ctrc in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-15-2017, 11:36 AM
  3. Combination without repetitions from 5 sets of number
    By alboholic in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 09-19-2016, 12:11 PM
  4. Count repetitions of occurences of value
    By TRGert in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-08-2013, 12:35 AM
  5. [SOLVED] Look up a value & text combination where the value is not an exact match in data table
    By Kraftyk in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 04-11-2013, 07:55 AM
  6. compare and count value repetitions
    By ElmerS in forum Excel General
    Replies: 6
    Last Post: 02-10-2010, 05:30 PM
  7. List without repetitions
    By mewingkitty in forum Excel General
    Replies: 3
    Last Post: 12-16-2008, 06:29 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