+ Reply to Thread
Results 1 to 13 of 13

Cross reference two overlapping data sets in the same table (matrix?)

  1. #1
    Registered User
    Join Date
    06-26-2015
    Location
    Michigan, United States
    MS-Off Ver
    2010
    Posts
    7

    Question Cross reference two overlapping data sets in the same table (matrix?)

    I have two sets of data that I want to cross-reference. The sets of data are the number of chapters and the names of characters that appear in those chapters. I want to be able to view data point "Chapter 1" and see what characters appear there (such as Kyra, Betty, John, Garic). Then I want to be able to view data point "Kyra" and see what chapters she appears in (Chapter 1, Chapter 2, Chapter 4, etc.).

    Currently, I have the data arranged in two separate lists (which is obviously very ineffective). Is there a way to combine these data points into a single format so that they are all together and navigable? There are hundreds of each data point, and creating a matrix (the kind with every data point on both axes and an X where they overlap) would be obviously very inefficient.

    Current format:
    excel.png
    Attached Files Attached Files
    Last edited by McRebecky; 06-26-2015 at 03:03 PM.

  2. #2
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Cross reference two overlapping data sets in the same table (matrix?)

    I cannot see png files. Can you upload an example spreadsheet (Go Advanced>Manage Attachments)
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  3. #3
    Registered User
    Join Date
    06-26-2015
    Location
    Michigan, United States
    MS-Off Ver
    2010
    Posts
    7

    Re: Cross reference two overlapping data sets in the same table (matrix?)

    Attachment added

  4. #4
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Cross reference two overlapping data sets in the same table (matrix?)

    Okay, assuming it's okay for the chapters to be in individual cells, you can do this with an ARRAYED formula as follows

    In C10, I put this formula
    =IFERROR(INDEX($A$3:$A$7, SMALL(IF(ISNUMBER(SEARCH($A10,$B$3:$B$7)), ROW($A$3:$A$7)-2),COLUMNS($A$1:A$1))),"")
    ...confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer. Press F2 on that cell and try again.

    Then copy across and down
    See attachment.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    06-26-2015
    Location
    Michigan, United States
    MS-Off Ver
    2010
    Posts
    7

    Re: Cross reference two overlapping data sets in the same table (matrix?)

    Is there a method for compiling the array into a table that looks like the second table.

    Essentially format it so that the second table (table ROWS 10–14) auto-populates based on the values input into the first table (ROWS 3–7)?
    Similar to saying B10 = C10&", "&D10&", "......

    Can the array formula communicate across sheets? If table 1 was on one sheet and table 2 was on another sheet, could the array display in that second table/sheet?

  6. #6
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Cross reference two overlapping data sets in the same table (matrix?)

    Yes, the array formula could work across sheets. With so many characters and chapters, you would need to use VBA to get all the chapters into a single cell.

    Reattaching with table 2 on different sheet. I am also including another option with checkmarks in chapters where characters appear.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    06-26-2015
    Location
    Michigan, United States
    MS-Off Ver
    2010
    Posts
    7

    Re: Cross reference two overlapping data sets in the same table (matrix?)

    If I use the following macro, how can I select an entire range as a row, but tell it to end the text string at the blank cells (aka: don't display the ", " for all the blank remaining cells)? Would that be a conditional change to the macro, or something to do in the cell function with an if/else?

    [MACRO]

    Sub ConcatenateRange()
    '
    ' ConcatenateRange Macro
    ' Combine multiple cells into a single text string.
    '
    ' Keyboard Shortcut: Ctrl+o
    '
    Function ConcatinateRange(sourceRange As Excel.Range) As String
    Dim finalValue As String

    Dim cell As Excel.Range

    For Each cell In sourceRange.Cells
    finalValue = finalValue + CStr(cell.Value) + ", "
    Next cell

    ConcatinateRange = finalValue
    End Function
    Attached Files Attached Files
    Last edited by McRebecky; 06-26-2015 at 02:15 PM.

  8. #8
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Cross reference two overlapping data sets in the same table (matrix?)

    I added an IF ELSE section
    Please Login or Register  to view this content.
    I added a table created by the macro. in Col B, I did it the same way you did (with the new macro). In B, I didn't assume that the names would be in the same order so it includes a MATCH function to make sure that the right character is chosen.
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    06-26-2015
    Location
    Michigan, United States
    MS-Off Ver
    2010
    Posts
    7

    Re: Cross reference two overlapping data sets in the same table (matrix?)

    Thank you!! You have been amazingly helpful and wonderful!

  10. #10
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Cross reference two overlapping data sets in the same table (matrix?)

    This macro doesn't require any of the intermediate tables. Characters is a named range in the workbook (see attached). It reads directly from your first table (Character-Chapters)

    I used this in cells 'By Character'!D11:D15
    Please Login or Register  to view this content.
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    06-26-2015
    Location
    Michigan, United States
    MS-Off Ver
    2010
    Posts
    7

    Re: Cross reference two overlapping data sets in the same table (matrix?)

    Wonderful! Now I can compile the data efficiently with as little hassle as possible. Thanks!
    Attached Files Attached Files

  12. #12
    Registered User
    Join Date
    06-26-2015
    Location
    Michigan, United States
    MS-Off Ver
    2010
    Posts
    7

    Re: Cross reference two overlapping data sets in the same table (matrix?)

    Follow-up question:

    If there are two characters (say, John and Johnathon), is there a way to restrict the search/find so that the results for "john" don't return with the instances where "johnathon" occurs?

  13. #13
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Cross reference two overlapping data sets in the same table (matrix?)

    Okay, in this version, I made use of that last macro (post #10) to completely remove the Arrayed functions (they will just slow down your system). Look at Formulas Tab>Name Manager to see the dynamic named range I created there.

    I now modified the macro so that it looks for either the name at the end of the string
    Please Login or Register  to view this content.
    or if not there, then followed by a comma
    Please Login or Register  to view this content.
    That should do the trick and worked in the example with Johnathan.
    New Macro
    Please Login or Register  to view this content.
    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. [SOLVED] Need to Cross Refernece two sets of data
    By 105ben in forum Excel General
    Replies: 6
    Last Post: 02-19-2015, 02:47 PM
  2. Table Cross Reference
    By 13lack13lade in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-10-2013, 11:58 PM
  3. Replies: 0
    Last Post: 08-06-2013, 10:59 AM
  4. [SOLVED] Correlation matrix between two data sets
    By Alexander_Golinsky in forum Excel General
    Replies: 6
    Last Post: 04-26-2012, 06:41 AM
  5. cross reference a table
    By Mile029 in forum Excel General
    Replies: 8
    Last Post: 09-07-2010, 01:01 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