+ Reply to Thread
Results 1 to 8 of 8

Can excel get all names in a column and exclude duplicates?

Hybrid View

  1. #1
    Valued Forum Contributor
    Join Date
    12-22-2010
    Location
    Texas
    MS-Off Ver
    Excel 2003 & Excel/Access 2007
    Posts
    438

    Can excel get all names in a column and exclude duplicates?

    Hello I am trying to get a list of all names found in a column but exclude duplicates... I know this can be done in a pivot table but I need the names in a drop down box... if I use the pivot table as the source it will pick up "Grand Total" as a name.

    The number of people can increase from week to week...

  2. #2
    Forum Expert
    Join Date
    12-11-2011
    Location
    Netherlands
    MS-Off Ver
    office 365
    Posts
    3,646

    Re: Can excel get all names in a column and exclude duplicates?

    You can use 'remove duplicates' (2007) or 'advanced filter' to get unique values
    Willem
    English is not my native language sorry for errors
    Please correct me if I'm completely wrong

  3. #3
    Valued Forum Contributor
    Join Date
    12-22-2010
    Location
    Texas
    MS-Off Ver
    Excel 2003 & Excel/Access 2007
    Posts
    438

    Re: Can excel get all names in a column and exclude duplicates?

    I could but in this case that option won't work... those names are duplicates but they have columns where the data is different...

  4. #4
    Forum Expert
    Join Date
    12-11-2011
    Location
    Netherlands
    MS-Off Ver
    office 365
    Posts
    3,646

    Re: Can excel get all names in a column and exclude duplicates?


  5. #5
    Forum Contributor
    Join Date
    05-08-2013
    Location
    California
    MS-Off Ver
    Excel 2013
    Posts
    102

    Re: Can excel get all names in a column and exclude duplicates?

    Consider the following approach that uses the .Add method. Here are my assumptions.

    Assumption 1: Your list of possibly repeated words resides entirely in Column A in a continuous range (i.e., there are no cells that are skipped or blank) and starts in Cell A1.

    Assumption 2: The final list of unique (i.e., non-duplicated) words will be shown in Column B (starting in Cell B1).

    Paste in the following code into a module and run the macro:

    Sub RemoveDupes()
    
    'Declare variables
    Dim nodupes As New Collection
    Dim siterange As Range
    Dim cell As Range
    Dim sites() As String
    Dim s As Long
    
    Application.ScreenUpdating = False
    
    Columns("B:B").ClearContents
    Set siterange = Range("A1").CurrentRegion
    
    'Build nodupes collection
    On Error Resume Next
    For Each cell In siterange
        nodupes.Add cell.Value, CStr(cell.Value)
    Next cell
    On Error GoTo 0
    
    'Dimensionalize and populate site vector
    ReDim sites(1 To nodupes.Count)
    For s = 1 To nodupes.Count
        sites(s) = nodupes(s)
    Next s
    
    'Transfer array to Column B
    For s = 1 To UBound(sites)
        Cells(s, 2) = sites(s)
    Next s
    
    Application.ScreenUpdating = True
    
    End Sub
    Hope this helps.

    ______________________________________
    1. If this reply was helpful, please click the star to the left.
    2. If this reply answered your question, mark this thread as [SOLVED].
    Last edited by Dimitrov; 09-11-2013 at 03:13 PM.

  6. #6
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Can excel get all names in a column and exclude duplicates?

    you can use a pivot table ,hide the grand total (right click ,hide)
    then use 2 dynamic named ranges when you add new names refresh the pivot and the dropdown will update
    Attached Files Attached Files
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

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

    Re: Can excel get all names in a column and exclude duplicates?

    Using the worksheet created by martindwilson, you can also create a dynamic named list from the Pivot Table a different way using this formula to be used in your Data Validation:

    Formula: copy to clipboard
    =OFFSET(Sheet1!M2,0,0,COUNTA(Sheet1!M:M)-1,1)


    I don't claim this to be better, only another option.
    <---------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

  8. #8
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Can excel get all names in a column and exclude duplicates?

    trouble with only one dynamic named range i found if the pivot updates either the names aren't added because the source range is fixed or if you make it larger than you have, the table includes a cell with "(blank)" written in it which doesnt move down when a new name added

+ 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. SUMIFS and exclude Duplicates with a table reference
    By GOQC in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 06-06-2013, 01:24 PM
  2. Replies: 5
    Last Post: 08-29-2012, 11:35 AM
  3. Sum column exclude duplicates
    By ryan@csi in forum Excel Formulas & Functions
    Replies: 19
    Last Post: 11-18-2009, 02:40 PM
  4. [SOLVED] Max Value in a column exclude selection - Excel VBA
    By magix in forum Excel General
    Replies: 3
    Last Post: 11-05-2005, 05:20 PM
  5. Count 350 SS numbers, exclude duplicates
    By Marsha in forum Excel General
    Replies: 5
    Last Post: 03-07-2005, 02:06 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