Results 1 to 13 of 13

List the 20 most common names in a column

Threaded View

  1. #11
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,501

    Re: List the 20 most common names in a column

    One way using UDF
    In G2 and drag down 40 rows (or as far as you need):

    =top($B$2:$B$36,ROWS($1:1))

    with B2:B36 is street name range, rows() generate 1,2,3...

    and code of that function: (Alt-F11 to open VBA window, insert/module, copy this code into)
    PHP Code: 
    Option Explicit
    Function Top(ByVal rng As RangeAs Integer)
    Dim i&, j&, k&, namedic As Objectres(1 To 100001 To 2), tmp1tmp2
    Set dic 
    CreateObject("Scripting.Dictionary")
    name rng.Value
    For 1 To UBound(name)
        If 
    Not dic.exists(name(i1)) Then
            dic
    .Add name(i1), 100
            k 
    1res(k1) = name(i1): res(k2) = 100
        
    Else
            
    dic(name(i1)) = dic(name(i1)) + 1
            
    For 1 To k
                
    If res(j1) = name(i1Then res(j2) = res(j2) + 1
            Next
        End 
    If
    Next
    For 1 To k 1
        
    For 1 To k
            
    If res(i2) < res(j2Then
                tmp1 
    res(j1): tmp2 res(j2)
                
    res(j1) = res(i1): res(j2) = res(i2)
                
    res(i1) = tmp1res(i2) = tmp2
            End 
    If
        
    Next
    Next
    Top 
    IIf(<= dic.Countres(n1), "")
    End Function 
    Attached Files Attached Files
    Last edited by bebo021999; 03-29-2023 at 11:22 PM.
    Quang PT

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Lookup names then return names from another column to create another list, sorted.
    By major_johnson in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 11-07-2022, 03:10 PM
  2. Column has Excused Names, Column B has List of Names, Can Column C Cross Reference B v A?
    By knuckledownlacrosse in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 01-27-2022, 07:13 PM
  3. How many names are common between lists and how many are not in any list
    By Clairep in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 09-09-2021, 05:39 AM
  4. [SOLVED] Need help deriving a list of common values in a column
    By cozcoester in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-06-2016, 01:14 AM
  5. Replies: 2
    Last Post: 12-08-2015, 03:01 PM
  6. List only the common term(s) from a list in a column
    By jordan2322 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-06-2013, 07:50 PM
  7. Replies: 5
    Last Post: 04-17-2012, 12:28 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