+ Reply to Thread
Results 1 to 6 of 6

Return the 2nd and 3rd most common values from a column

  1. #1
    Registered User
    Join Date
    08-15-2014
    Location
    Lisbon, Portugal
    MS-Off Ver
    Microsoft Office Professional Plus 2010
    Posts
    17

    Return the 2nd and 3rd most common values from a column

    Hello,

    I'd like to have a formula to return the 2nd most common value from a column on one cell, and the 3rd one on another cell. Right now I'm using this one for the most common: =INDEX(RawData!O1:O10000,MATCH(MAX(COUNTIFS(RawData!O1:O10000,RawData!O1:O10000,RawData!K1:K10000,C1)),COUNTIFS(RawData!O1:O10000,RawData!O1:O10000,RawData!K1:K10000,C1),0))

    One thing to bare in mind is that I'm restricting the values, such that another column has to return a certain value, hence Mode function probably wouldn't work.

    Thanks for helping out!

  2. #2
    Valued Forum Contributor spitfireblue's Avatar
    Join Date
    01-29-2015
    Location
    Adelaide, Australia
    MS-Off Ver
    2007,2010,2016
    Posts
    611

    Re: Return the 2nd and 3rd most common values from a column

    Try this:

    1st
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    2nd
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    3rd
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Regards,
    Stephen

    If you feel someone has helped you please thank them and click on the star on their post to add reputation.
    Please ensure that you use code tags where relevant, and mark solved threads as solved.
    Most of all please be respectful and understanding of others.

  3. #3
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2404
    Posts
    13,406

    Re: Return the 2nd and 3rd most common values from a column

    Another way.

    In B1 this formula filled across until you get blanks.
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Row\Col
    A
    B
    C
    D
    E
    1
    5
    1
    8
    11
    =IFERROR(INDEX($A$1:$A$40,INDEX(MATCH(LARGE(FREQUENCY($A$1:$A$40,$A$1:$A$40),{1,2,3}),(FREQUENCY($A$1:$A$40,$A$1:$A$40)),0),COLUMNS($B:B))),"")
    2
    11
    3
    5
    4
    4
    5
    9
    6
    7
    7
    1
    8
    9
    9
    3
    10
    11
    11
    2
    12
    1
    13
    10
    14
    12
    15
    4
    16
    6
    17
    11
    18
    8
    19
    6
    20
    3
    21
    9
    22
    2
    23
    12
    24
    8
    25
    8
    26
    1
    27
    2
    28
    1
    29
    8
    30
    1
    31
    7
    32
    1
    33
    10
    34
    6
    35
    8
    36
    12
    37
    4
    38
    7
    39
    11
    40
    9
    Dave

  4. #4
    Registered User
    Join Date
    08-15-2014
    Location
    Lisbon, Portugal
    MS-Off Ver
    Microsoft Office Professional Plus 2010
    Posts
    17

    Re: Return the 2nd and 3rd most common values from a column

    thank you for your answers. maybe I haven't explained myself clearly. attached below is an example (coloured in green) of what I want to automate. So basically I want the top 3 cities in cells D4, E4 and F4 of the country spelled in D2. This should come from the column B, and each matching country is in column A.

    paris.png

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

    Re: Return the 2nd and 3rd most common values from a column

    Many members are unable to see images in the *.png format due to forum compatibility issues with some browsers.

    If you need to post an image post it in the *.jpg format.

    Even better than posting images... post a SMALL sample file. That way we can test solutions directly in the file with the relevant data.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

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

    Re: Return the 2nd and 3rd most common values from a column

    For the example given in post 4, try this array formula (ctrl+shift+enter) in D4, drag sideways:
    Please Login or Register  to view this content.

+ 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. Return most common, 2nd common...within the data range
    By tantcu in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-07-2015, 06:06 PM
  2. Return most common text from column cells with formula while ignoring blanks
    By rosco01995 in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 10-29-2014, 03:55 AM
  3. Return common values in multiple worksheets into one worksheet
    By haskenazi in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-06-2014, 10:10 PM
  4. [SOLVED] need vba code to compare two column get result of common values of both column
    By breadwinner in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-12-2013, 05:42 AM
  5. [SOLVED] Cross Reference two columns and return common values?
    By chewedbacca in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 06-27-2013, 12:29 PM
  6. Replies: 1
    Last Post: 04-22-2013, 03:24 PM
  7. Returning most common values in a column
    By Sixty7 in forum Excel General
    Replies: 2
    Last Post: 03-03-2011, 05:55 AM

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