+ Reply to Thread
Results 1 to 5 of 5

Top 7 cccurrence in a range

  1. #1
    Registered User
    Join Date
    02-07-2008
    Posts
    60

    Top 7 cccurrence in a range

    Hello all,

    I would like to find 7 numbers in a range which occurred the most. For example I attached a worksheet. I have a range of numbers (A1:G13). I would like to have a macro which will check which numbers occurred the most and then that numbers will be written in the bordered row (A16:G16). In the next row (A19:G19) I would like to see the occurrence count of the particular number.

    Would you be so kind and help me with this macro?

    I appreciate all your replies.
    Thank you
    Attached Files Attached Files

  2. #2
    Forum Expert Bob Phillips's Avatar
    Join Date
    09-03-2005
    Location
    Wessex
    MS-Off Ver
    Office 2003, 2010, 2013, 2016, 365
    Posts
    3,284

    Re: Top 7 cccurrence in a range

    Use this array formula

    =INDEX(A$1:A$13,MATCH(MAX(COUNTIF(A$1:A$13,A$1:A$13)),COUNTIF(A$1:A$13,A$1:A$13),0))

    and this no-array formula

    =COUNTIF(A$1:A$13,A$16)

  3. #3
    Registered User
    Join Date
    02-07-2008
    Posts
    60

    Re: Top 7 cccurrence in a range

    Hi Bob,

    Thank you very much for your fast response. I tried to copy the first formula to cell A16 but it shows an error and return value "n/a". What I did wrong?

  4. #4
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Top 7 cccurrence in a range

    Please Login or Register  to view this content.



  5. #5
    Forum Expert Bob Phillips's Avatar
    Join Date
    09-03-2005
    Location
    Wessex
    MS-Off Ver
    Office 2003, 2010, 2013, 2016, 365
    Posts
    3,284

    Re: Top 7 cccurrence in a range

    Quote Originally Posted by Link View Post
    Hi Bob,

    Thank you very much for your fast response. I tried to copy the first formula to cell A16 but it shows an error and return value "n/a". What I did wrong?
    You didn't array-enter it.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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