+ Reply to Thread
Results 1 to 15 of 15

To display most repeated text / value from a range of cells

  1. #1
    Registered User
    Join Date
    02-09-2009
    Location
    Bahrain
    MS-Off Ver
    Excel 2007
    Posts
    11

    To display most repeated text / value from a range of cells

    Hi

    In my excel sheet i have few results displayed in range (same row different column with few banks cells in between). No i wish to display the most repeated value / result from that range into another cell on a different sheet of the same workbook. Can somebody help please.

    Please note that the data (that is displayed in the cell rage from where i wish to get the most repeated one) is a the result of a nested IF statement.
    16 minutes ago

    I tried
    Please Login or Register  to view this content.
    but it is displaying #N/A error value but it si not correct as all my celles have result as "A3" displayed after execution of "IF" statement

    some one told me to try
    Please Login or Register  to view this content.
    but its also not working.
    Last edited by VBA Noob; 02-09-2009 at 09:12 AM.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: To display most repeated text / value from a range of cells

    MODE is the right function for this if the data is all numeric. Your first formula works for me. That's a pretty short range, too, only 3 cells.

    Post up a clear set of data examples and we can look at why it's not working on your data.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    02-09-2009
    Location
    Bahrain
    MS-Off Ver
    Excel 2007
    Posts
    11

    Post Re: To display most repeated text / value from a range of cells

    Hi Thanks for your valued feedback, my data is numeric but as result of if statement i am geting a text value displayed in range.

    The range provided in my query was just for example

  4. #4
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: To display most repeated text / value from a range of cells

    If the IF is returning "A3" then the results are non-numeric...

    See this thread:

    http://www.excelforum.com/excel-gene...xt-string.html

    From which Richard Schollar offers:

    Please Login or Register  to view this content.
    So the MODE is based on an array of MATCH returns for each value in the range... eg {1,2,1} ... whichever is the most common value can be used in an INDEX to return that value... in the above this would be the value in position 1 in the range... ie K6 and I6 are the same (Match returned 1) ... thus return value from I6 as this is most common.
    Last edited by DonkeyOte; 02-09-2009 at 05:02 AM.

  5. #5
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: To display most repeated text / value from a range of cells

    Quote Originally Posted by Kimabdalian View Post
    Hi Thanks for your valued feedback, my data is numeric but as result of if statement i am geting a text value displayed in range.

    The range provided in my query was just for example
    So the values are numeric, but actually text strings, they just look like numbers? Well, here's an interesting twist on the MODE which fixes that...pretty weird:

    =MODE((I6:K6)*1)

  6. #6
    Registered User
    Join Date
    02-09-2009
    Location
    Bahrain
    MS-Off Ver
    Excel 2007
    Posts
    11

    Question Re: To display most repeated text / value from a range of cells

    Hi

    Thanks, the following worked for me but now i have another problem that how to ignore empty cells

    Please Login or Register  to view this content.
    The above is working perfectly well... except that, when the IF satatement returns empty value in 12 cells out of 15, the result is also shown empty. I wish that the empty cells must be ignored. How to do that i only want the maximum number of results not empty cells. Any ideas?

  7. #7
    Forum Expert
    Join Date
    06-18-2004
    Location
    Canada
    MS-Off Ver
    Office 2016
    Posts
    1,474

    Re: To display most repeated text / value from a range of cells

    Try...

    Please Login or Register  to view this content.
    ...confirmed with CONTROL+SHIFT+ENTER.

    Hope this helps!

  8. #8
    Registered User
    Join Date
    02-09-2009
    Location
    Bahrain
    MS-Off Ver
    Excel 2007
    Posts
    11

    Post Re: To display most repeated text / value from a range of cells

    Hi Domenic

    Thanks it worked... but now i have another issue, i wish to display the last cell (which ever is populted with data) from the same range to another cell. How can i do that?

  9. #9
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: To display most repeated text / value from a range of cells

    =INDEX(I6:W6,MATCH(9.99999999999999E+307,I6:W6))
    ...to find the last numeric value in a range of numeric only values in I6:W6.

    =INDEX(I6:W6,MATCH(REPT("z",255),I6:W6))
    ...to find the last text value in a range of text values I6:W6.

    =INDEX(I6:W6,MAX(MATCH(9.99999999999999E+307,I6:W6),MATCH(REPT("z",255),I6:W6)))
    ...to find the last value in a range with BOTH text and numeric values in I6:W6.

    NOTE: That last formula will only work if there is at least one text and one numberic value.

  10. #10
    Registered User
    Join Date
    02-09-2009
    Location
    Bahrain
    MS-Off Ver
    Excel 2007
    Posts
    11

    Post Re: To display most repeated text / value from a range of cells

    Hi JBeaucaire

    Thanks a lot, i tried teh second formula but its is not displaying naything wheras my cells I,J,K,M, and N (6) have text values displayed in them as result of the If statement ( please note that cell L is empty and cells from O to W are empty)

    Am i doing something wrong here?

  11. #11
    Registered User
    Join Date
    02-09-2009
    Location
    Bahrain
    MS-Off Ver
    Excel 2007
    Posts
    11

    Post Re: To display most repeated text / value from a range of cells

    Please not that i now in this case I want to display the last value not the most repeated value

  12. #12
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: To display most repeated text / value from a range of cells

    Post up your data, or a usable and clear sample of it. Highlight the cell where you're formula is failing and indicate your desired result (which we know, just want to be totally clear).

    GO ADVANCED and click on the paperclip icon to upload a workbook.

  13. #13
    Registered User
    Join Date
    02-09-2009
    Location
    Bahrain
    MS-Off Ver
    Excel 2007
    Posts
    11

    Post Re: To display most repeated text / value from a range of cells

    Thank JBeaucaire

    Please see attached the workbook as per yoru advise.
    Attached Files Attached Files
    Last edited by Kimabdalian; 03-02-2009 at 06:29 AM.

  14. #14
    Forum Expert
    Join Date
    06-18-2004
    Location
    Canada
    MS-Off Ver
    Office 2016
    Posts
    1,474

    Re: To display most repeated text / value from a range of cells

    Since it looks like the data will always contain text values, try...

    Please Login or Register  to view this content.
    Otherwise, try...

    Please Login or Register  to view this content.
    Hope this helps!

  15. #15
    Registered User
    Join Date
    02-09-2009
    Location
    Bahrain
    MS-Off Ver
    Excel 2007
    Posts
    11

    Thumbs up Re: To display most repeated text / value from a range of cells

    Hi Domenic

    Thanks a lot, you are a star...

    The second formula worked.
    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)

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