+ Reply to Thread
Results 1 to 3 of 3

Remove duplicate names from 2 colums / multiple rows

Hybrid View

quikgun15 Remove duplicate names from 2... 11-03-2014, 02:36 PM
Bernie Deitrick Re: Remove duplicate names... 11-03-2014, 04:03 PM
alikazmi Re: Remove duplicate names... 11-05-2014, 03:49 AM
  1. #1
    Registered User
    Join Date
    03-10-2009
    Location
    La La Land
    MS-Off Ver
    Excel 2003
    Posts
    36

    Remove duplicate names from 2 colums / multiple rows

    Hi,

    Hoping someone can assist. I've attached my spreadsheet.

    I have 3 colums with multiple rows for one user.

    Column A is my user
    Column B is a group they're under
    Column C is groups that they need to be added to


    I need two things:

    #1: There are duplicates within columns B & C (over multiple rows) - which i would like to get rid of.

    #2: If the group exist in Column B for the user, i need it to be removed from Column C or somehow highlighted or easily pointed out so i can delete manually if i need to
    for e.g. in the chart below... WB35 is in Column B and Column C.... what i need is for it to be removed from Column C

    A B C
    USER Group Additional Groups
    a WB47 WB12,WB31,WB35
    a WB35 WB02,WB07
    a WB08 WB01,WB11,WB09



    Any help is appreciated.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    6,274

    Re: Remove duplicate names from 2 colums / multiple rows

    Try this macro - I have assumed that the cell contents are values and not formulas.

    Sub Macro1()
        Dim c As Range
        Dim a As Range
        Dim r As Long
        Dim f As Range
        
        With Worksheets("Sheet1").Sort
            .SortFields.Clear
            .SortFields.Add Key:=Range("A:A"), Order:=xlAscending
            .SortFields.Add Key:=Range("B:B"), Order:=xlAscending
            .SetRange Range("A1").CurrentRegion
            .Header = xlYes
            .Orientation = xlTopToBottom
            .Apply
        End With
        
        For r = Cells(Rows.Count, "A").End(xlUp).Row To 2 Step -1
            If Cells(r, "A").Value <> Cells(r - 1, "A").Value Then
                Cells(r, "A").EntireRow.Insert
            End If
        Next r
        
        For Each a In Range("A:A").SpecialCells(xlCellTypeConstants).Areas
            For Each c In a.Offset(0, 1)
                a.Offset(0, 2).Replace ", " & c.Value, ""
                a.Offset(0, 2).Replace c.Value & ", ", ""
                a.Offset(0, 2).Replace "," & c.Value, ""
                a.Offset(0, 2).Replace c.Value & ",", ""
                a.Offset(0, 2).Replace c.Value, ""
            Next c
        Next a
        
        Range("A:A").SpecialCells(xlCellTypeBlanks).EntireRow.Delete
        
    End Sub
    Bernie Deitrick
    Excel MVP 2000-2010

  3. #3
    Registered User
    Join Date
    11-05-2014
    Location
    pakistan
    MS-Off Ver
    2013
    Posts
    4

    Re: Remove duplicate names from 2 colums / multiple rows

    Sorry for late replay, If you seriously want to learn Excel A to Z perfectly you need for perfect tuts also Perfect Guides, This Group will help you thanks check this Excel Advise

+ 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. Need to copy store names from sheet1 to sheet3 and remove duplicate names
    By aleanboy in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-21-2014, 08:47 AM
  2. Replies: 1
    Last Post: 10-06-2014, 09:44 AM
  3. [SOLVED] INDIRECT with conditions problem - spreadsheet copied weekly same rows/colums/names
    By annazet in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-04-2013, 11:22 AM
  4. excel macro to remove specific columns and rows + remove duplicate
    By garrywelson in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 01-17-2013, 12:03 PM
  5. Replies: 8
    Last Post: 04-12-2012, 08:02 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