+ Reply to Thread
Results 1 to 5 of 5

Find Most Common Occurring String Based on Lookup Value

Hybrid View

  1. #1
    Registered User
    Join Date
    12-04-2013
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    3

    Find Most Common Occurring String Based on Lookup Value

    Hi,

    I am trying to figure out a way to find the most common occurring string in my spreadsheet based on a lookup value. For example, if my table is as follows:

    Capture.PNG

    1. I want to calculate the most common value chosen by user 234 (A in this case), user 524 (B in this case)... and so on.
    2. I want to calculate the percent of the chosen value. So in the previous point, A was chosen ~67% of the time by user 234... and so on.

    I'm not sure which formula to use. I am able to find the most common occurring value in column B using the formula below (which I found here), but how can I do that for a specific value, a user ID in this case?

    Formula: copy to clipboard
    =INDEX(B2:B16,MATCH(MAX(COUNTIF(B2:B16,B2:B16)),COUNTIF(B2:B16,B2:B16),0))

    Pardon by phraseology, I'm not sure if "lookup value" is the correct term to use here, but I hope I explained my question well.

    Thank you.

  2. #2
    Forum Contributor vamosj's Avatar
    Join Date
    04-23-2004
    Location
    Oregon
    MS-Off Ver
    2010
    Posts
    294

    Re: Find Most Common Occurring String Based on Lookup Value

    There might be an easier looking way, but here's a formula I devised that you can use to type in the ID number you wish to view then it will automatically search through that list and only pull most common selection(s). I adjusted this so that if there was a tie it will represent both items that were picked.

    Place the formula into any cell you want to use to display the returned value then set up a cell for you to input the ID you want to search for. In the below formula you will have to adjust the highlighted part of the formula (Cell E2) to point to where you put the ID you are searching for.

    =CONCATENATE(IF(COUNTIFS(A:A,E2,B:B,"a")=MAX(COUNTIFS(A:A,E2,B:B,{"a","b","c"})),"a","")," ",IF(COUNTIFS(A:A,E2,B:B,"b")=MAX(COUNTIFS(A:A,E2,B:B,{"a","b","c"})),"b","")," ",IF(COUNTIFS(A:A,E2,B:B,"c")=MAX(COUNTIFS(A:A,E2,B:B,{"a","b","c"})),"c",""))

    I've attached a spreadsheet that I used so you can see it in action.
    Attached Files Attached Files
    Last edited by vamosj; 12-05-2013 at 12:10 PM.
    Janos S. Vamos
    Data Systems Technician/Fire Controlman PO1(SW/AW)
    US Navy Retired


    Remember, Record Macro can be your friend for figuring out solutions.

    Good or Bad, let me know how I did by clicking on the "Add Reputation" * just to the lower left of here. it only takes a few seconds to let someone know.

  3. #3
    Registered User
    Join Date
    12-04-2013
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Find Most Common Occurring String Based on Lookup Value

    This works great. Thank you vamosj!

  4. #4
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,167

    Re: Find Most Common Occurring String Based on Lookup Value

    Based on your last post in this thread, its apparent that you are satisfied with the solution(s) you've received and have solved your question, but you haven't marked your thread as "SOLVED". I will do it for you this time.

    In future, to mark your thread as Solved, you can do the following -
    Select Thread Tools-> Mark thread as Solved.

    Incase your issue is not solved, you can undo it as follows -
    Select Thread Tools-> Mark thread as Unsolved.

    Also, since you are relatively new to the forum, i would like to inform you that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post which helped you. This adds to the reputation of the person who has taken the time to help you.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  5. #5
    Registered User
    Join Date
    12-04-2013
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Find Most Common Occurring String Based on Lookup Value

    Thanks for the tip! Will keep it mind.

+ 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. Find most frequently occurring text string in in a VISIBLE range of cells
    By Odlanier in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 12-01-2013, 05:27 PM
  2. [SOLVED] Find out the length of common string between cells of two columns.
    By rampulaparthi in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 08-28-2013, 03:25 AM
  3. 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
  4. [SOLVED] URGENT find common string values in 2 colums
    By M.Karim in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-13-2012, 11:21 AM
  5. Find the lest common string-value in a range
    By ElmerS in forum Excel General
    Replies: 4
    Last Post: 02-01-2009, 06:25 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