Results 1 to 3 of 3

Set a range of cells for searching missing combinations

Threaded View

  1. #1
    Registered User
    Join Date
    01-06-2013
    Location
    New York, EUA
    MS-Off Ver
    Excel 2013
    Posts
    77

    Set a range of cells for searching missing combinations

    Hi everybody,

    The following macro searches for missing combinations. This macro will search the complete list and will return any missing combination from "1, 2, 3, 4" to "7, 8, 9, 10".

    Sub missing_combos()
    
    Dim dic As Object, q As Variant
    Dim a&, b&, c&, d&, k&
    
    Set dic = CreateObject("scripting.dictionary")
    
    q = Range([g5], [j5].End(4))
    
    For a = 1 To UBound(q)
        dic(Join(Array(q(a, 1), q(a, 2), q(a, 3), q(a, 4)), ",")) = 1
    Next a
    
    For a = 1 To 10
        For b = a + 1 To 10
            For c = b + 1 To 10
                For d = c + 1 To 10
                    If dic(Join(Array(a, b, c, d), ",")) <> 1 Then
                        k = k + 1
                        Cells(k + 1, "l").Resize(, 4) = Array(a, b, c, d)
                    End If
                Next d
            Next c
        Next b
    Next a
    
    End Sub
    I need your help to make some changes in this macro, so that it will search for missing combinations only within a specified range of cells (and not the whole list). For example (see excel file attached), I would like to place a search within range("G23:J183"), from combination "1, 2, 6, 9" to combination "4, 6, 8, 10". In this case, it should return only 9 missing combinations.

    Any help is welcomed. Thank you very much.

    John
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Find missing combinations
    By JOAO12 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-08-2014, 07:14 PM
  2. Searching through a group of cells to find missing people.
    By babak_jani in forum Excel General
    Replies: 1
    Last Post: 11-14-2013, 01:52 AM
  3. Searching combinations
    By christheta in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-04-2010, 06:08 AM
  4. Searching for letter combinations
    By h3lla in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-26-2008, 10:14 PM
  5. Searching for 50 combinations of something out of hundreds.
    By schueyisking in forum Excel General
    Replies: 21
    Last Post: 08-14-2008, 12:09 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