+ Reply to Thread
Results 1 to 7 of 7

Function "MODE" applied to characters.

  1. #1
    Registered User
    Join Date
    03-23-2011
    Location
    Portugal
    MS-Off Ver
    Excel 2003
    Posts
    4

    Function "MODE" applied to characters.

    Sorry my English!

    What I need is to calculate the mode, lets say in column A2:A8, where I have in each cell diferent letters. exemple:

    A2=F
    A3=D
    A4=H
    A5=J
    A6=F
    A7=F
    A8=F

    So, the letter that most repeats is "F". Is it possibile to write a code, that gives me the mode from A2 to A8?
    I Work with excel 2007.
    Thank you!
    Last edited by NBVC; 03-24-2011 at 03:35 PM.

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Function "MODE" applied to characters.

    Try:

    =INDEX(A2:A8,MATCH(MAX(COUNTIF(A2:A8,A2:A8)),COUNTIF(A2:A8,A2:A8),0))

    confirmed with CTRL+SHIFT+ENTER not just ENTER

    See attachment for translations to your language/version.
    Attached Files Attached Files
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Registered User
    Join Date
    03-23-2011
    Location
    Portugal
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Function "MODE" applied to characters.

    Quote Originally Posted by NBVC View Post
    Try:

    =INDEX(A2:A8,MATCH(MAX(COUNTIF(A2:A8,A2:A8)),COUNTIF(A2:A8,A2:A8),0))

    confirmed with CTRL+SHIFT+ENTER not just ENTER

    See attachment for translations to your language/version.
    Hey! It works! Awsome! The formula is like chinese to me, but it works so it's great!
    Thank you very very much.
    By the way, just thinking, what if there are 2 or 3 letters that repeats equally? Could the formula tell that the mode is "f & t", for example?

    Thank you.

  4. #4
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Function "MODE" applied to characters.

    Unless you have a fixed number of times you know it will repeat, you will need a couple of helpers...

    So if your original list is in A2:A8, for example,

    then in C2 enter formula:
    Please Login or Register  to view this content.
    confirmed with CTRL+SHIFT+ENTER

    Then in B2 enter formula:
    Please Login or Register  to view this content.
    copied down.

    and in D2 enter formula:

    Please Login or Register  to view this content.
    then to get results use:

    Please Login or Register  to view this content.
    confirmed with CTRL+SHIFT+ENTER and copied down.

    If you know the number of times a max repeat will happen, then you just need the last formula copied down that many times.

  5. #5
    Registered User
    Join Date
    03-23-2011
    Location
    Portugal
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Function "MODE" applied to characters.

    Jesus! I've copied down the formulas down to my excel sheet, but didnīt study them yet, cause I'm at work right now. A2:A8 it's just an example, cause the real case is hundreds of cells, and I don't know how many times "letters" will repeat. I only know the letters I will have to use, dontīknow if that helps.
    To test this formulas, I've put in A2:A8, three "F" and three "T", wrote down this formulas to excel, like you said, but didnīt understand the final result. This last formula got me the result "t". If doesnīt bother you, maybe you could send me this formulas in excell sheet, like it's sopposed to be working, in case i'm not doing it right.

    Once again, thank you so much. It's people like you that make this world much better.
    Last edited by NBVC; 03-24-2011 at 12:09 PM. Reason: deleted spurious quote & removed email address for protection of OP

  6. #6
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Function "MODE" applied to characters.

    As is often the case, after looking at it again, I think I overcomplicated it a bit... the final formal doesn't need to be that complex... substitute it with:
    Please Login or Register  to view this content.
    Entered only with ENTER.

    I attached the document here for you.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    03-23-2011
    Location
    Portugal
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Function "MODE" applied to characters.

    Excelent. Works perfectly. Thank you so much.
    It's exaclly what I needed. You're the boss.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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