+ Reply to Thread
Results 1 to 9 of 9

Macro to return columns as described in the post

  1. #1
    Registered User
    Join Date
    11-11-2013
    Location
    Bucharest
    MS-Off Ver
    2016
    Posts
    19

    Question Macro to return columns as described in the post

    Hello. I've posted this in the part of the forum about formulas, but I'm starting to doubt that there is such a formula, so here's my question again, exemplified.

    I have a table of 36x36 containing values of 1's and 0'2, plus a 37th column that has the sums of each row. (example of 6X7 below, 7th column being the one containing the sums)

    ABCDEF G
    010101 3
    010011 3
    010101 3
    001011 3
    001101 3
    001011 3

    I need to know if there's a macro out there that can help me by returning the following: every possibility (combination) of column summing that would make the entire 7th column have ONLY even or ONLY odd results.

    For the example above, possibilities for even results are:
    A
    A+B+C+D+E
    A+B+C+F
    B+C+D+E
    B+C+F

    For odd results:
    A+B+C+D+E+F
    A+B+C
    A+D+E
    A+F
    B+C+D+E+F
    B+C
    D+E
    F

    If there is no such macro, is there any way of creating a program, or anything similar?

    Thank you in advance.
    Asth.

  2. #2
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Macro to return columns as described in the post

    Please Login or Register  to view this content.
    Something like that might do it. It would take FOREVER though. You would be looking at billions of possible combinations.

    Disclaimer: untested obviously. It may or may not work!
    I don't think there is a way to do this that isn't brute force though, unless there is some pattern to your numbers.

    I reckon it's a fair bet that are part from trivial solutions (all zero's or single 1's in each line) there aren't going to be any others.
    Last edited by ragulduy; 11-12-2013 at 11:08 AM.

  3. #3
    Registered User
    Join Date
    11-11-2013
    Location
    Bucharest
    MS-Off Ver
    2016
    Posts
    19

    Re: Macro to return columns as described in the post

    I'll try this out as soon as I get home, thanks! The only pattern I've seen in my table is that column A = row 1; column B = row 2; and so on. I know there can be quite a lot of possibilities, however I have a feeling there are only 2 valid. :P Thanks again. I'll get back to you with results. (or further questions)

  4. #4
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Macro to return columns as described in the post

    Haha, I wouldn't be in such a rush. It was more an example of how you would approach it but scaled up to 36x36, even as a conservative estimate you would be looking at like, a month to run something like that.

    How are your numbers populated? are they all 1's and 0's? What do you need the information for?

  5. #5
    Registered User
    Join Date
    11-11-2013
    Location
    Bucharest
    MS-Off Ver
    2016
    Posts
    19

    Re: Macro to return columns as described in the post

    They represent a puzzle. If you look at the puzzle, it's a circle with symbols on it. Each symbol activates some others, therefor for symbol 1, I add one to each of the symbols it affects. I need them all activated, thus, the results need to be all even or all odd. :P

  6. #6
    Registered User
    Join Date
    11-11-2013
    Location
    Bucharest
    MS-Off Ver
    2016
    Posts
    19

    Re: Macro to return columns as described in the post

    Sorry, I wrote that in a hurry. If I get into it more, it sounds like this.

    There are 36 symbols. Each activates a number of other symbols. (4, 6 or 9 others) So, for example, if symbol 1 activates symbols 5, 13, 27 and 33, then column A will have 1's on rows 5, 13, 27, 33, and 0's for the rest 32 symbols. (numbers) After turning the puzzle into an excel project, I noticed that the upper right side is a mirror of the lower left one, so there's a diagonal of 1's from A1 to AJ36. I figured it's all just a form of complex math that could be simplified by a macro or formula, but I might have been wrong. :P I've tried to think of it in a C++ form either by turning it into 36 matrices of 1x36, or by using it as a single 36x36 matrix. Considering I haven't used any programing in well over 6 years, I failed miserably. So I turned to help here.

  7. #7
    Registered User
    Join Date
    11-11-2013
    Location
    Bucharest
    MS-Off Ver
    2016
    Posts
    19

    Re: Macro to return columns as described in the post

    Another thing I tried but was unable to, was to think of the matter the following way:

    C <- combinations
    n = no. of columns
    k <= n
    c(x) column 1 through x
    x = 1 through 36

    So I tried to figure a way that would tell me if c(37) = (C of n by k (sum of c(x))) is either odd or even. I have no idea how to convert that into code, though...

  8. #8
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Macro to return columns as described in the post

    I don't quite see how what your asking for will help you with the puzzle but anyway... I take it the goal is to have the symbols on?

    It sounds like a variation of "lights out". If you do a google search for "lights out solving algorithm" or something along those lines there is loads of stuff available on these sorts of problems.

  9. #9
    Registered User
    Join Date
    11-11-2013
    Location
    Bucharest
    MS-Off Ver
    2016
    Posts
    19

    Re: Macro to return columns as described in the post

    That information was golden. It is indeed that type of puzzle. 4 corners (4 tiles affecting 4 others) 16 margins (4x4 affecting 6 others) and 16 in the center. (4x4 affecting 9 others) After that it went down simple rearranging and figuring out. Consider this topic solved from my point of view, although my idea didn't really have an ending. :P And thank you very much for ending my torment. :P

+ 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] macro to lookup two dates and return figure in corresponding month columns
    By tiger01 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-11-2013, 02:55 AM
  2. [SOLVED] Compare 2 columns with another 2 columns as return value from 3rd column
    By DHFE in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-04-2013, 07:54 AM
  3. Lookup 2 columns and return value based on another 2 columns
    By rlsublime in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-13-2012, 11:16 AM
  4. Match Columns in 2 Worksheets, return only changed values of other columns
    By cheynooki in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-17-2011, 01:19 PM
  5. Need Macro to auto-hide columns that return no value
    By SiH in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-15-2009, 07:58 PM

Tags for this Thread

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