+ Reply to Thread
Results 1 to 11 of 11

Most frequent value given condition

  1. #1
    Registered User
    Join Date
    12-21-2006
    MS-Off Ver
    Office 2013
    Posts
    73

    Most frequent value given condition

    I am trying to get the most common color sold of a particular frame given a large list of frames. I came across another thread with a similar question but the check data was numerical so the formula given was:

    =INDEX(E1:E20000,MODE(IF(A1:A20000=C2537,IF(E1:E20000<>"",MATCH(E1:E20000,E1:E20000,0)))))

    Obviously this won't work for text since the MODE function is only for numbers. I need a similar formula that will work for textual values.

    Many thanks

  2. #2
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,617

    Re: Most frequent value given condition

    A quick answer proposition without insight in (sample data) attachment:

    May be you shall use pivot table with your color as row headers counter in value field and condition(s) as filter(s).
    Then ask Pivot table to show only max value?
    Best Regards,

    Kaper

  3. #3
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,929

    Re: Most frequent value given condition

    Perhaps take a look at using countifS() function?

    Attach a sample workbook. Make sure there is just enough data to make it clear what is needed. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are demonstrated, mock them up manually if needed. Remember to desensitize the data.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  4. #4
    Registered User
    Join Date
    12-21-2006
    MS-Off Ver
    Office 2013
    Posts
    73

    Re: Most frequent value given condition

    So my columns look like this:

    Frame Color
    ------- --------
    Adam II Gunmetal
    Adam II Gunmetal
    Adam II Brown
    Adam II Gold Antique
    David Burgundy
    David Gold
    David Brown
    David Gold
    Katelyn Rose
    Katelyn Rose
    Katelyn Brown
    Katelyn Walnut Fade
    Nathan Gold
    Nathan Brown
    Nathan Mauve
    Nathan Mauve

    I would like to know the most common color sold for each frame. In the above data I would get gunmetal for the "Adam II" frame, Gold for the "David" frame, rose for the "Katelyn" frame and mauve for the "Nathan" frame

  5. #5
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,617

    Re: Most frequent value given condition

    reading from forum rules:
    Post a WORKBOOK. Nobody wants to type data from a picture or paste text from your post into a spreadsheet as a prelude to helping. To attach a file, push the button with the paperclip (or scroll down to the Manage Attachments button), browse to the required file, and then push the Upload button.
    I still suggest Pivot table

  6. #6
    Registered User
    Join Date
    12-21-2006
    MS-Off Ver
    Office 2013
    Posts
    73

    Re: Most frequent value given condition

    Workbook attached...pivot table is not what I am looking for
    Attached Files Attached Files

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

    Re: Most frequent value given condition

    You can use the INDEX/MODE formula - the data doesn't have to be numbers for that to work - MATCH returns a number and then MODE returns a row number based on that (with INDEX returning the relevant item) so that should work OK for you here, e.g.

    =INDEX(B$2:B$700,MODE(IF(A$2:A$700="Arnie",IF(A$2:A$700<>"",MATCH(B$2:B$700,B$2:B$700,0)*{1,1}))))

    confirmed with CTRL+SHIFT+ENTER
    Audere est facere

  8. #8
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,147

    Re: Most frequent value given condition

    @dll:
    would this do the same without the array constant?
    =INDEX(B$2:B$70,MODE(IF(A$2:A$700="Arnie",IF(B$2:B$700<>"",MATCH(B$2:B$700,B$2:B$700,0)))))

    since A2:A700 is already checked for "Arnie".

    Thanks, if you have clicked on the * and added our rep.

    If you're satisfied with the answer, click Thread Tools above your first post, select "Mark your thread as Solved".

    "Contentment is not the fulfillment of what you want, but the realization of what you already have."


    Tips & Tutorials I Compiled | How to Get Quick & Good Answers

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

    Re: Most frequent value given condition

    Yes, apologies, the "blank check" should be against column B, as you say, perhaps not even required if all non-blank rows are populated in both columns A and B.

    The {1,1} part just ensures that you get back a result even when there is a single entry (as MODE normally returns #N/A when no number is repeated)

  10. #10
    Registered User
    Join Date
    12-21-2006
    MS-Off Ver
    Office 2013
    Posts
    73

    Re: Most frequent value given condition

    Thanks so much dll, works great!!
    Last edited by enphynity; 01-30-2014 at 03:57 PM.

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

    Re: Most frequent value given condition

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.
    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]

+ 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. Looking up most frequent and compare
    By mansho in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-30-2012, 06:24 AM
  2. Replies: 3
    Last Post: 03-20-2012, 09:53 PM
  3. Sort by ID, and find most frequent ones..
    By QualAnalyzer in forum Excel General
    Replies: 6
    Last Post: 11-06-2011, 10:53 AM
  4. Less frequent markers
    By SanFranciscoSarah in forum Excel General
    Replies: 1
    Last Post: 04-28-2011, 12:47 PM
  5. [SOLVED] Find the most frequent date
    By MarkN in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-25-2006, 08:20 PM

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