+ Reply to Thread
Results 1 to 12 of 12

Most Occuring Number

  1. #1
    Registered User
    Join Date
    06-27-2013
    Location
    Detroit, Michigan
    MS-Off Ver
    Microsoft 2013
    Posts
    36

    Most Occuring Number

    Hi,
    I am sure someone asked a similar questions before. But, I cannot seem to find what I am looking for. Seems simple but cannot get anything to work. Basically I want to know which number in Column B occurs the most for each number in Column A. Please see attached example.
    Thanks
    Attached Files Attached Files
    Last edited by dodgemain; 02-03-2019 at 08:35 AM.

  2. #2
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,064

    Re: Most Occuring Number

    What happens when there's a tie? What output do you want then?
    Regards
    Special-K

    Ensure you describe your problem clearly, I have little time available to solve these problems and do not appreciate numerous changes to them.

  3. #3
    Registered User
    Join Date
    06-27-2013
    Location
    Detroit, Michigan
    MS-Off Ver
    Microsoft 2013
    Posts
    36

    Re: Most Occuring Number

    Hi,
    I was thinking about listing the top three results. It's shown in my example spreadsheet.
    Thanks

    Quote Originally Posted by Special-K View Post
    What happens when there's a tie? What output do you want then?

  4. #4
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,064

    Re: Most Occuring Number

    Your output doesnt make sense.

    There are 2 x AE20s with a 6, 6 is the only number that follows AE20 so thats the top occurrence of AE20 - thats fine.
    AL10 has a 2 x 9s and an 8 - so 9 is the top occurrence for AL10 - with 8 coming in second place - thats fine.

    But AL20 has only one occurrence of being followed by a 1 and only one occurrence of being followed by a 2 - so how come the 2 is in second place?

    BA10 with 4 and 5 is ok

    Same problem with BA20 3 and 4 as above

    BA30 with 9 and 8 is ok

    DK40 with 6 and 5 is ok

    DK50 with 8 and 9 - again it's a draw - same problem as above.

  5. #5
    Registered User
    Join Date
    06-27-2013
    Location
    Detroit, Michigan
    MS-Off Ver
    Microsoft 2013
    Posts
    36

    Re: Most Occuring Number

    Hi,
    I see what you are saying. Not sure how to handle those. The chances for my data only having single numbers is very small. Maybe should leave the scenario out.
    Thanks


    Quote Originally Posted by Special-K View Post
    Your output doesnt make sense.

    There are 2 x AE20s with a 6, 6 is the only number that follows AE20 so thats the top occurrence of AE20 - thats fine.
    AL10 has a 2 x 9s and an 8 - so 9 is the top occurrence for AL10 - with 8 coming in second place - thats fine.

    But AL20 has only one occurrence of being followed by a 1 and only one occurrence of being followed by a 2 - so how come the 2 is in second place?

    BA10 with 4 and 5 is ok

    Same problem with BA20 3 and 4 as above

    BA30 with 9 and 8 is ok

    DK40 with 6 and 5 is ok

    DK50 with 8 and 9 - again it's a draw - same problem as above.

  6. #6
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,064

    Re: Most Occuring Number

    =COUNTIFS(A$1:A$20,A1,B$1:B$20,B1) provides the number of occurrences of the columns A and B.
    You then need to RANK in a group of columns A and B, not my area of expertise I'm afraid but I'll have a play round with it.

  7. #7
    Forum Expert KOKOSEK's Avatar
    Join Date
    08-03-2018
    Location
    Pole in Yorkshire, UK
    MS-Off Ver
    365/2013
    Posts
    2,742

    Re: Most Occuring Number

    Try:

    ={IFERROR(LARGE(IF($A$1:$A$20=$E3,$B$1:$B$20),COLUMN()-5),"")} (CSE needed)
    drag down / right as needed.


    But as been said, in the case of draw 1st most frequent = 2nd most frequent or 2nd=3rd etc.
    And also generate error if only 1 or 2 possible number appear and you want to display 3rd most frequent (that's why I've add IFERROR)
    Happy with my answer * Add Reputation.
    If You are happy with solution, please use Thread tools and mark thread as SOLVED.

  8. #8
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,887

    Re: Most Occuring Number

    To return most frequently occurring number, you'd normally use MODE family of functions.
    Ex: =MODE(IF(($A$1:$A$21=$E3)*(1-ISNUMBER(MATCH($B$1:$B$21,TRANSPOSE($E3:E3),0))),$B$1:$B$21))
    Confirmed as Array (CTRL + SHIFT + ENTER). Copy across and down.

    However... you'd require at least 2 or more occurrence of any given number or it will return error (i.e. number cannot be unique based on condition).

    With your sample, only AE20, AL10, BA10, BA30, DK40 will return valid result. And each has only one valid result (meaning all numbers that belong to other values in Column A are unique).

    0.JPG

    See attached for better sample for demonstration.
    Attached Files Attached Files
    Last edited by CK76; 01-21-2019 at 01:20 PM. Reason: Added sample file.
    ?Progress isn't made by early risers. It's made by lazy men trying to find easier ways to do something.?
    ― Robert A. Heinlein

  9. #9
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: Most Occuring Number

    Please try at F3 with CSE drag across and down

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

  10. #10
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Most Occuring Number

    Another way. Requires Excel 2010 or newer.

    Array entered.
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Dave

  11. #11
    Registered User
    Join Date
    06-27-2013
    Location
    Detroit, Michigan
    MS-Off Ver
    Microsoft 2013
    Posts
    36

    Re: Most Occuring Number

    Thanks for everyone's help!

  12. #12
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Most Occuring Number

    You are welcome. Glad to help. Thank you for the feedback and marking your thread Solved.

+ 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. [SOLVED] Plot first occuring number only
    By Sekars in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-27-2016, 03:10 AM
  2. Count number of event types occuring by month (SUMPRODUCT?)
    By iswizzle in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 09-23-2015, 03:04 PM
  3. Replies: 2
    Last Post: 12-17-2013, 06:30 AM
  4. most frequently occuring set
    By apok9f in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-25-2013, 04:29 AM
  5. Most occuring name in a list?
    By theprof in forum Excel General
    Replies: 4
    Last Post: 05-25-2008, 07:22 PM
  6. Calculating number of instances occuring in an hour for 24 hours
    By rp in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-12-2006, 11:35 AM
  7. Re-occuring Inspection Dates
    By Bill Kuunders in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 09-06-2005, 02:05 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