+ Reply to Thread
Results 1 to 3 of 3

Loop thru every combination

  1. #1
    Registered User
    Join Date
    05-30-2015
    Location
    SVK
    MS-Off Ver
    2016
    Posts
    38

    Loop thru every combination

    Also posted here:
    http://www.ozgrid.com/forum/showthread.php?t=201337

    Hi,
    in attached file I made example of a Range method to find by country a combination of 2 values that add up to amount on the right.
    However, Belgium doesn't get its Cell Addresses, because 138 is Sum of 3 values (E9, E10, E16).

    I look for a looping mechanism, that would go through each 2-combination of values until it finds the result,
    otherwise would continue with 3-combination, 4 .. up to all items combination necessary to find respective SUM.

    Example:
    A-B, A-C, A-D ..... A-Z
    A-B-C, A-B-D ...A-B-Z ; A-C-D .. A-C-Z ...
    Attached Files Attached Files

  2. #2
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Loop thru every combination

    I'm sure there is a much cleaner way to do this... but this works for 3 combinations, you'd have to follow the logic to say if no match after 3 combinations, try 4, and so on:

    Please Login or Register  to view this content.
    Please help by:

    Marking threads as closed once your issue is resolved. How? The Thread Tools at the top
    Any reputation (*) points appreciated. Not just by me, but by all those helping, so if you found someone's input useful, please take a second to click the * at the bottom left to let them know

    There are 10 kinds of people in this world... those who understand binary, and those who don't.

  3. #3
    Registered User
    Join Date
    05-30-2015
    Location
    SVK
    MS-Off Ver
    2016
    Posts
    38

    Re: Loop thru every combination

    Thank you Arkadi

+ 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. Loop with several variables; how to cover every possiable combination
    By edickman in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-15-2015, 05:22 PM
  2. [SOLVED] Macro combination Vlookup and Hlookup Match in a loop
    By FroukeWiersma in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 11-19-2013, 03:52 AM
  3. Reset Macro Button Code in combination with a Loop
    By tnuis in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-30-2013, 06:09 AM
  4. [SOLVED] Copy dynamically changing column and Paste using VBA Loop (Loop within Loop)
    By nixon72 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-12-2013, 12:46 PM
  5. [SOLVED] how many cell in a row that contain certain combination from a larger combination
    By system in forum Excel Formulas & Functions
    Replies: 18
    Last Post: 11-17-2012, 03:04 PM
  6. Why did an inner loop variable start overwriting the outer loop range suddenly?
    By 111StepsAhead in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-16-2012, 03:24 PM
  7. Using loop and finding the right row combination?
    By hvisa in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-07-2011, 02:02 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