+ Reply to Thread
Results 1 to 6 of 6

Most common string in column with an exception

  1. #1
    Registered User
    Join Date
    09-16-2008
    Location
    Ottawa, Canada
    Posts
    29

    Most common string in column with an exception

    I am trying to find the most common string in a column but I need to ignore a certain value.

    I found this formula in another thread and it works great for it's intended purpose but I need to modify it to ignore 0's.

    =INDEX(A2:A10,MODE(MATCH(A2:A10,A2:A10,0)))


    Example Data:

    john
    mary
    john
    0
    0
    mary
    bill
    john
    0
    0


    The result should be john not 0. Is this possible?

    Any help is greatly appreciate.

    Thanks
    Rob
    Last edited by Bytor47; 04-11-2013 at 07:48 AM. Reason: mark as solved

  2. #2
    Forum Expert
    Join Date
    12-15-2009
    Location
    Chicago, IL
    MS-Off Ver
    Microsoft Office 365
    Posts
    3,177

    Re: Most common string in column with an exception

    Not smart enough to come up with a formula solution, so try UDF

    Please Login or Register  to view this content.
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    09-16-2008
    Location
    Ottawa, Canada
    Posts
    29

    Re: Most common string in column with an exception

    Thanks for the quick response. I'll give that a try but in the meantime would it help if I changed the 0's to blanks?

    Data:

    john
    mary
    john
    (empty cell)
    (empty cell)
    mary
    bill
    john
    (empty cell)
    (empty cell)
    bill


    Result = john

  4. #4
    Forum Expert
    Join Date
    12-15-2009
    Location
    Chicago, IL
    MS-Off Ver
    Microsoft Office 365
    Posts
    3,177

    Re: Most common string in column with an exception

    If you replace 0 with empty cell then you can use an old school array formula
    Enter with Ctrl + Shift + Enter keys together

    =INDEX(A1:A8,MATCH(MAX(COUNTIF(A1:A8,A1:A8)),COUNTIF(A1:A8,A1:A8)))

  5. #5
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Most common string in column with an exception

    You could keep the zeroes and use this version

    =INDEX(A2:A10,MODE(IF(A2:A10<>0,MATCH(A2:A10,A2:A10,0))))

    confirmed with CTRL+SHIFT+ENTER

    There needs to be at least 2 of one of the names otherwise you get #N/A
    Audere est facere

  6. #6
    Registered User
    Join Date
    09-16-2008
    Location
    Ottawa, Canada
    Posts
    29

    Re: Most common string in column with an exception

    Thanks for all the help from both of you.

    I'll play around with each of them and figure out which is most appropriate for what I'm doing.

    Thanks again.

+ 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