+ Reply to Thread
Results 1 to 21 of 21

How to find repeated or most common numbers from rows?

  1. #1
    Forum Contributor
    Join Date
    01-21-2011
    Location
    London,UK
    MS-Off Ver
    Excel 2007
    Posts
    241

    Question How to find repeated or most common numbers from rows?

    Good afternoon,
    would you kindly assist with formula to find most common or repeated numbers in rows from "A:F"?
    here is an example;

    Please Login or Register  to view this content.
    Thanks
    Sem
    Last edited by JBeaucaire; 11-02-2014 at 11:16 AM.

  2. #2
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,448

    Re: How to find repeated or most common numbers from rows?

    Is each group of 5 numbers contained in the same cell?

  3. #3
    Forum Contributor
    Join Date
    01-21-2011
    Location
    London,UK
    MS-Off Ver
    Excel 2007
    Posts
    241

    Re: How to find repeated or most common numbers from rows?

    Hi Pepe le Mokko,
    Please Login or Register  to view this content.
    Yes,thank you.
    Sem

  4. #4
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,914

    Re: How to find repeated or most common numbers from rows?

    can you post sample file
    Samba

    Say thanks to those who have helped you by clicking Add Reputation star.

  5. #5
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: How to find repeated or most common numbers from rows?

    I used text to columns to get each value in its own cell. This gave an array A2:AJ4. Next select AN2:AM2 and enter this array formula: (enter with Ctrl + Shift + Enter)

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Result:

    B
    C
    D
    E
    F
    G
    H
    I
    J
    K
    L
    M
    N
    O
    P
    Q
    R
    S
    T
    U
    V
    W
    X
    Y
    Z
    AA
    AB
    AC
    AD
    AE
    AF
    AG
    AH
    AI
    AJ
    AK
    AL
    AM
    AN
    1
    A B C D E F EXPECTED RESULT
    2
    1
    4
    5
    13
    16
    2
    6
    13
    16
    20
    3
    7
    9
    13
    16
    8
    10
    12
    13
    16
    11
    13
    15
    16
    17
    13
    14
    16
    18
    19
    13
    16
    3
    1
    2
    3
    12
    15
    1
    4
    9
    12
    19
    1
    5
    12
    18
    20
    1
    6
    12
    16
    17
    1
    7
    8
    12
    14
    1
    10
    11
    12
    13
    1
    12
    4
    1
    5
    9
    14
    17
    2
    3
    5
    9
    18
    4
    5
    6
    9
    12
    5
    7
    9
    16
    19
    5
    8
    9
    10
    11
    5
    9
    13
    15
    20
    5
    9


    I don't see how this can be done keeping the groupings in one cell for each group unless it can be done with VBA.
    Last edited by newdoverman; 11-02-2014 at 01:57 PM.
    <---------If you like someone's answer, click the star to the left of one of their posts to give them a reputation point for that answer.
    Ron W

  6. #6
    Forum Contributor
    Join Date
    01-21-2011
    Location
    London,UK
    MS-Off Ver
    Excel 2007
    Posts
    241

    Re: How to find repeated or most common numbers from rows?

    nevdowerman,
    thanks ever so much for your time and help itlooks very good solution, but i rather have a solution without to need text to columns.
    Siva,
    in my post#1, have sample which is exactly similar to my data.
    thanks again
    Sem

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

    Re: How to find repeated or most common numbers from rows?

    Quote Originally Posted by newdoverman View Post
    I don't see how this can be done keeping the groupings in one cell for each group unless it can be done with VBA.


    I concur with this, VBA programming would be needed for this. If you're OK with VBA, I could create a User-Defined-Function that would do this and you could install it into your workbook(s) as needed. Not everyone wants/allows macros in their projects. Let me know.
    _________________
    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!)

  8. #8
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,914

    Re: How to find repeated or most common numbers from rows?

    see the attached file
    Attached Files Attached Files

  9. #9
    Forum Contributor
    Join Date
    01-21-2011
    Location
    London,UK
    MS-Off Ver
    Excel 2007
    Posts
    241

    Re: How to find repeated or most common numbers from rows?

    nflsales,
    i looked at attached workbook it promising because your formula giving, one number where it should be two numbers repeated?
    anyhow very much appreciated.
    JBeaucare,
    if its not possible with formula, then i dont mind if its vb code,thanks.
    Sem

  10. #10
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,914

    Re: How to find repeated or most common numbers from rows?

    see the attached file
    it is an array formula
    Attached Files Attached Files

  11. #11
    Forum Contributor
    Join Date
    01-21-2011
    Location
    London,UK
    MS-Off Ver
    Excel 2007
    Posts
    241

    Re: How to find repeated or most common numbers from rows?

    Hi Nflsales,
    thanks ever so much for your time and help very much appreciated.
    i can get the first number, but i'm having problem getting the second number.how do you apply the formula?, do you copy it across and down.Because i compered both formula and they are exactly same ,i get value# error in my result???
    Thanks again.
    Sem

  12. #12
    Forum Guru
    Join Date
    05-24-2011
    Location
    India
    MS-Off Ver
    Office 2021
    Posts
    2,237

    Re: How to find repeated or most common numbers from rows?

    Hello Sem,

    What version of excel are you using 2007 or above?

    So, you only want to return MULTIPLE most common numbers, if they are occurring equal time?

    eg: 13 & 16 occur 6 times in row 1, so if they occur 6 & 5 time, do you only want to return 13?


    Edit: If you are on Excel 2010 or above,

    G1, then copy across until get error.

    =INDEX(MODE.MULT(TRIM(MID(SUBSTITUTE($A1:$F1," ",REPT(" ",20)),{0;1;2;3;4}*20+1,20))+0),COLUMNS($G1:G1))
    Last edited by Haseeb Avarakkan; 11-02-2014 at 03:36 PM.
    Regards,
    Haseeb Avarakkan

    __________________________________
    "Feedback is the breakfast of champions"

  13. #13
    Forum Contributor
    Join Date
    01-21-2011
    Location
    London,UK
    MS-Off Ver
    Excel 2007
    Posts
    241

    Re: How to find repeated or most common numbers from rows?

    Hi Haseeb A,
    thanks for your time,
    So, you only want to return MULTIPLE most common numbers, if they are occurring equal time?

    eg: 13 & 16 occur 6 times in row 1, so if they occur 6 & 5 time, do you only want to return 13?
    every row have two numbers occur equally in all columnsand i need both numbers
    Thanks again,kind regards
    Sem

  14. #14
    Forum Guru
    Join Date
    05-24-2011
    Location
    India
    MS-Off Ver
    Office 2021
    Posts
    2,237

    Re: How to find repeated or most common numbers from rows?

    OK, try this

    G1,

    =MODE(TRIM(MID(SUBSTITUTE(A1:F1," ",REPT(" ",20)),{0;1;2;3;4}*20+1,20))+0)

    H1,

    =MODE(IFERROR(TEXT(TRIM(MID(SUBSTITUTE(A1:F1," ",REPT(" ",20)),{0;1;2;3;4}*20+1,20))+0,"[<>"&G1&"]0;-")+0,""))

    Both are Array Formulas, must be conformed with CTRL+SHIFT+ENTER

  15. #15
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,914

    Re: How to find repeated or most common numbers from rows?

    Formula for getting 1st number and 2nd number are not same

  16. #16
    Forum Contributor
    Join Date
    01-21-2011
    Location
    London,UK
    MS-Off Ver
    Excel 2007
    Posts
    241

    Re: How to find repeated or most common numbers from rows?

    HaseebA,
    thanks very very much for perfect solution,but if i may what is the "20" and "0,1,2,3,4" stand for?
    suppose my data's numser over 20 is that mean i need to change the "20" in the formula accordingly?
    Thanks again
    Sem


    Ps.i added reputation for your excellent solution.

  17. #17
    Forum Guru
    Join Date
    05-24-2011
    Location
    India
    MS-Off Ver
    Office 2021
    Posts
    2,237

    Re: How to find repeated or most common numbers from rows?

    Quote Originally Posted by sem View Post
    ..thanks very very much...
    You are welcome. Glad it works for you :-)

    ...what is the "20" and "0,1,2,3,4" stand for...
    0;1;2;3;4 means you have data across in 5 columns. A:F. If you have more columns change it accordingly.

    20 is just used to separate these values by 20 spaces to get values in array.

    ....suppose my data's numser over 20 is that mean i need to change the "20" in the formula accordingly?...
    No. Only if you have large numbers >19 character.

  18. #18
    Forum Contributor
    Join Date
    01-21-2011
    Location
    London,UK
    MS-Off Ver
    Excel 2007
    Posts
    241

    Re: How to find repeated or most common numbers from rows?

    HaseebA,
    much obliged for your explaination,thanks a million.
    Sem

  19. #19
    Forum Contributor
    Join Date
    01-21-2011
    Location
    London,UK
    MS-Off Ver
    Excel 2007
    Posts
    241

    Re: How to find repeated or most common numbers from rows?

    HaseebA,
    I'm very sorry to bother you but i get "#value" error when apply this formula to data with 16 columns"A:P" with numbers "1:50"
    Please Login or Register  to view this content.
    any help on this please?.
    Thanks

  20. #20
    Forum Guru
    Join Date
    05-24-2011
    Location
    India
    MS-Off Ver
    Office 2021
    Posts
    2,237

    Re: How to find repeated or most common numbers from rows?

    Sem,

    My bad.

    {0;1;2;3;4} means you have 5 group of numbers in a cell. So just keep it as it is. No need {0;1;2;3;4;5;6;7;8;9;10;11;12;13;14;15}

    Sorry for the confusion.

  21. #21
    Forum Contributor
    Join Date
    01-21-2011
    Location
    London,UK
    MS-Off Ver
    Excel 2007
    Posts
    241

    Re: How to find repeated or most common numbers from rows?

    Thanks Haseeb that sorted the problem.
    Kind regards
    Sem

+ 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. How to find the most common numbers?
    By alikirca20 in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 02-04-2013, 09:34 AM
  2. Replies: 4
    Last Post: 06-01-2012, 10:31 PM
  3. Find out what these numbers have in common
    By morsoe in forum Excel General
    Replies: 3
    Last Post: 07-27-2011, 07:39 AM
  4. find common occurrence of numbers
    By tachyon in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-26-2008, 10:21 AM
  5. find the greatest value among repeated rows in a sheet
    By shijy in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-30-2005, 02:22 AM

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