+ Reply to Thread
Results 1 to 3 of 3

Counting Unique Elements Across Multiple Non-Consecutive Columns

  1. #1
    Registered User
    Join Date
    03-15-2013
    Location
    Pittsburgh
    MS-Off Ver
    Office 2013
    Posts
    3

    Counting Unique Elements Across Multiple Non-Consecutive Columns

    This is something I'm sure has been solved before, and I just haven't found the solution yet, but I'll ask anyway:
    I have an Excel spreadsheet consisting of a few (>10) columns. 4 of these columns contain important information in text. (The other columns contain other data that is not relevant to my current task.) These columns of text are not next to each other, and I don't want to change the way the columns are arranged because it all makes sense in context. What I need is a program to run in excel that takes in these 4 non-consecutive columns and outputs 2 new columns. New column A should contain every unique item in the 4 original lists. For example, if List 1 was A,B,C,D, List 2 was E,C,A,F, List 3 was G,H,I,C, and List 4 was B,J,K,L, the output list would be A,B,C,D,E,F,G,H,I,J,K,L. (For the record, it does not matter if these elements come out the other side sorted in any way.) New Column 2 would then contain the number of instances of each element in New Column 1. So, if we look at my last example, where output list 1 is A,B,C,D,E,F,G,H,I,J,K,L, the output list 2 would read 2,2,3,1,1,1,1,1,1,1,1,1. So far, I've managed to find a VB program that finds unique elements in a list and outputs them as a new list, but I don't have a clue how to expand this to do what I want to do. If anybody has any ideas, or a link to where the problem has been solved previously, I would quite like to see/hear them. Thanks!

  2. #2
    Valued Forum Contributor
    Join Date
    07-29-2009
    Location
    Belgium
    MS-Off Ver
    Excel 2003/Excel 2010
    Posts
    534

    Re: Counting Unique Elements Across Multiple Non-Consecutive Columns

    See attachment, run macro "tst".
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    03-15-2013
    Location
    Pittsburgh
    MS-Off Ver
    Office 2013
    Posts
    3

    Re: Counting Unique Elements Across Multiple Non-Consecutive Columns

    Thank you! This was exactly what I needed!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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