+ Reply to Thread
Results 1 to 7 of 7

Excel - Sorting Groups of Duplicate Data

  1. #1
    Registered User
    Join Date
    11-04-2011
    Location
    Australia
    MS-Off Ver
    Excel 2007
    Posts
    12

    Cool Excel - Sorting Groups of Duplicate Data

    Hi,

    I have sorted a list by a number of levels within excel to find groups of data. I would now like to order those groups of data from the highest frequency of duplicate values to the lowest frequency of duplicate values.

    E.g. Currently my excel sheet list looks like this:

    Column Column Column Column Column
    A B C D E
    No | Applicant Name | Applicant Surname | Respondent Name | Respondent Surname
    1 A B C D
    2 A B C D
    3 E F G H
    4 I J K L
    5 I J K L
    6 I J K L
    7 M N O P

    However, I would like to keep the data together but order the data from the largest amount of duplicate rows to the least amount of duplicate rows (i.e. keeping the entire row together where the values from columns B-E are the same), so it would look instead like this:

    Column Column Column Column Column
    A B C D E
    No | Applicant Name | Applicant Surname | Respondent Name | Respondent Surname
    4 I J K L
    5 I J K L
    6 I J K L
    1 A B C D
    2 A B C D
    3 E F G H
    7 M N O P

    How can this be done? Does it require a macro of some sort? I have looked all over the internet for an answer so help would be great...!

    Thanks, Chris
    Last edited by chrisjc19; 11-04-2011 at 07:41 PM. Reason: Solved

  2. #2
    Registered User
    Join Date
    11-04-2011
    Location
    Australia
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: Excel - Sorting Groups of Duplicate Data

    p.s. and if anyone then knows how to make the background cell color for each group of duplicates change when there is different unique group of duplicates, that would be even more great!

    Eg:

    FFFFFF
    FFFFFF
    FFFFFF
    FFFFFF
    AAAAAA
    AAAAAA
    AAAAAA

    BBBBBB
    BBBBBB

    JJJJJJ

  3. #3
    Forum Expert
    Join Date
    03-31-2009
    Location
    Barstow, Ca
    MS-Off Ver
    Excel 2002 & 2007
    Posts
    2,164

    Re: Excel - Sorting Groups of Duplicate Data

    Cell G1: =B1&C1&D1&E1
    Cell H1: =Countif(G:G,G1)

    Copy both formulas down the column, then sort A:H on column H

    You can alternate between 2 colors between different cells using conditional formatting, but to have it have more than 2 colors it takes a macro to permanently change the color.
    Foxguy

    Remember to mark your questions [Solved] and rate the answer(s)
    Forum Rules are Here

  4. #4
    Registered User
    Join Date
    11-04-2011
    Location
    Australia
    MS-Off Ver
    Excel 2007
    Posts
    12

    Smile Re: Excel - Sorting Groups of Duplicate Data

    Thanks heaps Foxguy! Your solution for my first post works great - you're a genius!

    However, I'm still having trouble with the second part in coloring the background of the rows where there is change in the 'duplicate groups'. I'm happy for only two colors to alternate or to have many colors as long as the different groups of duplicates can be distinguished. It does not seem obvious how conditional formatting achieves this as it seems to only allow highlighting of 'all' duplicate values. For example, using the column G that you suggested I add, the colors in the rows could alternate based on this column if possible, such as:

    Column G

    I J K L
    I J K L
    I J K L

    A B C D
    A B C D
    E F G H
    E F G H

    M N O P

    All the other columns in the same row would have the matching colour.

    Thanks once again for your assistance.

  5. #5
    Registered User
    Join Date
    11-04-2011
    Location
    Australia
    MS-Off Ver
    Excel 2007
    Posts
    12

    Smile Re: Excel - Sorting Groups of Duplicate Data

    Thanks heaps Foxguy! Your solution for my first post works great - you're a genius!

    However, I'm still having trouble with the second part in coloring the background of the rows where there is change in the 'duplicate groups'. I'm happy for only two colors to alternate or to have many colors as long as the different groups of duplicates can be distinguished. It does not seem obvious how conditional formatting achieves this as it seems to only allow highlighting of 'all' duplicate values. For example, using the column G that you suggested I add, the colors in the rows could alternate based on this column if possible, such as:

    Column G

    I J K L
    I J K L
    I J K L

    A B C D
    A B C D
    E F G H
    E F G H

    M N O P

    All the other columns in the same row would have the matching colour.

    Thanks once again for your assistance...!

  6. #6
    Forum Expert
    Join Date
    03-31-2009
    Location
    Barstow, Ca
    MS-Off Ver
    Excel 2002 & 2007
    Posts
    2,164

    Re: Excel - Sorting Groups of Duplicate Data

    I messed up on the conditional formatting.
    Try this:

    Cell J2: =J1+If(G2<>G1,1,0) 'skip row 1 - just put a 0 in J1
    copied down the column

    Conditional Formating A1:E:1 =IsEven($J1) 'format Green backgound

  7. #7
    Registered User
    Join Date
    11-04-2011
    Location
    Australia
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: Excel - Sorting Groups of Duplicate Data

    Thanks - that worked great!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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