+ Reply to Thread
Results 1 to 14 of 14

find most common name in a column

  1. #1
    Forum Contributor
    Join Date
    11-10-2012
    Location
    Sweden, Stockholm
    MS-Off Ver
    MS Excel 365
    Posts
    175

    find most common name in a column

    I want to find most common name in a column.
    preferably three top ones.

    How to do that?

  2. #2
    Forum Expert avk's Avatar
    Join Date
    07-12-2007
    Location
    India
    MS-Off Ver
    Microsoft Office 2013
    Posts
    3,223

    Re: find most common name in a column

    Try this one.
    For Horizantal Data : Suppose your data column row from "A2" to "J2"
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    For Vertical Data : Suppose your data column "A2" to "A10"
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    atul


    If my answer (or that of other members) has helped you, please say "Thanks" by clicking the Add Reputation button at the foot of one of their posts.

    Also: if your problem is solved, please take the time to mark your thread as SOLVED by going to the top of your first post, selecting "Thread Tools" and then "Mark thread as solved".

  3. #3
    Forum Contributor
    Join Date
    11-10-2012
    Location
    Sweden, Stockholm
    MS-Off Ver
    MS Excel 365
    Posts
    175

    Re: find most common name in a column

    I realized when using your coding is that I see that most common are empty rows.
    How to define the coding so not filled will not recognized?
    empty field or "unknown" should not be recognized.

    Thanks so far
    Last edited by sealpino; 01-15-2017 at 05:24 PM.

  4. #4
    Forum Contributor
    Join Date
    12-18-2016
    Location
    London
    MS-Off Ver
    Microsoft 2013
    Posts
    145

    Re: find most common name in a column

    Using this formula you can find the most common name in a column.
    =INDEX(B5:F5,MODE(MATCH(B5:F5,B5:F5,0)))

  5. #5
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: find most common name in a column

    Use a helper column (B) to count the occurrences of each name in column A.
    Assuming that the names start in A2 and go down the column enter this in B2 and fill down the length of the data
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Where you want the top 3 names enter this formula and fill down 3 rows total. If you fill down further, you will get the names in order of occurrences.
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Data Range
    A
    B
    C
    D
    1
    Name
    Count
    Top 3
    2
    a
    3.87783
    e
    3
    a
    t
    4
    a
    r
    5
    t
    4.235136
    6
    t
    7
    t
    8
    t
    9
    x
    2.506083
    10
    x
    11
    e
    6.84222
    12
    e
    13
    e
    14
    e
    15
    e
    16
    e
    17
    r
    3.934245
    18
    r
    19
    r
    20
    s
    2.069983
    21
    s
    <---------If you like someone's answer, click the star to the left of one of their posts to give them a reputation point for that answer.
    Ron W

  6. #6
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: find most common name in a column

    Quote Originally Posted by newdoverman View Post
    =IFERROR(IF(COUNTIF($A$2:A2,A2)=1,COUNTIF(A:A,A2),"")+RAND(),"")
    Although unlikely, it's still possible to get duplicates with the RAND() function.

    For guaranteed unique numbers do something like this...

    COUNTIF(...)-ROW()/1000000
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  7. #7
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: find most common name in a column

    Good idea Tony. Thanks for the input. Wouldn't this bias the tie-breaking in favour of the item higher up the list due to the increasing row number being divided by a constant resulting in a slightly overall lower value?

  8. #8
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: find most common name in a column

    I guess there's "bias" no matter which method you use.

    I was just looking at it from the perspective of generating guaranteed unique numbers.

    There are other methods of generating a top N list which accounts for ties.

  9. #9
    Forum Contributor
    Join Date
    11-10-2012
    Location
    Sweden, Stockholm
    MS-Off Ver
    MS Excel 365
    Posts
    175

    Re: find most common name in a column

    interesting reflections from you.
    So the final coding should look like....?

  10. #10
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: find most common name in a column

    To incorporate the guaranteed "no duplicates" use this which is a combination of my original formula with Tony Valko's suggestion. If there is a duplicate, the first duplicate in the list gets chosen.
    Enter in B2 and fill down
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    The top 3 are then calculated by the same formula as in Msg#5
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Data Range
    A
    B
    C
    1
    2
    b
    1.999998
    m
    3
    b
    f
    4
    v
    1.999996
    t
    5
    v
    6
    f
    3.999994
    7
    f
    8
    f
    9
    f
    10
    r
    1.99999
    11
    r
    12
    t
    3.999988
    13
    t
    14
    t
    15
    t
    16
    h
    3.999984
    17
    h
    18
    h
    19
    h
    20
    m
    5.99998
    21
    m
    22
    m
    23
    m
    24
    m
    25
    m
    26
    u
    3.999974
    27
    u
    28
    u
    29
    u

  11. #11
    Forum Contributor
    Join Date
    11-10-2012
    Location
    Sweden, Stockholm
    MS-Off Ver
    MS Excel 365
    Posts
    175

    Re: find most common name in a column

    I tried before to find a solution but did not work out.
    Attaching a doc in xls to see if I can get assisstance.
    Attached Files Attached Files

  12. #12
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: find most common name in a column

    To get the 5 largest values enter in I22 and fill down
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    To get the corresponding text value, enter in G22 and fill down (enter with Ctrl + Shift + Enter)
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    A better formula to use to get the text values associated with the top 5 values.
    Enter in G22 and fill down
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by newdoverman; 02-06-2017 at 10:22 AM.

  13. #13
    Forum Contributor
    Join Date
    11-10-2012
    Location
    Sweden, Stockholm
    MS-Off Ver
    MS Excel 365
    Posts
    175

    Re: find most common name in a column

    Thanks SUPERB!
    Sealpino

  14. #14
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: find most common name in a column

    Thank you for the feedback. I recommend that you use the "better" formula as it is not an array formula and is much more simple.

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

+ 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] How to compare & find common values in a column
    By baranboz in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-07-2016, 09:54 AM
  2. [SOLVED] find common value between two worksheet and copy data from 1 column.
    By SierraKilo78 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-17-2014, 11:28 PM
  3. Replies: 7
    Last Post: 07-13-2013, 03:01 PM
  4. How to find common string column from two columns??
    By sanil.henry1982 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-14-2012, 08:34 AM
  5. Replies: 16
    Last Post: 10-10-2012, 12:18 PM
  6. Replies: 5
    Last Post: 04-17-2012, 12:28 PM
  7. Need help with sorting a column by most common to least common
    By mikenmike0001 in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 12-06-2011, 04:28 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