+ Reply to Thread
Results 1 to 4 of 4

Removing Duplicate Values Only

Hybrid View

  1. #1
    Registered User
    Join Date
    07-05-2006
    Posts
    59

    Removing Duplicate Values Only

    I have searched and searched but can't seem to find the answer I once had.

    From A2:A159 I have a list of part numbers (no duplicates). Then for each part, from Column B through Column DX there are quantity values.

    Going one row at a time, I need to delete all duplicate entries.

    Considerations:

    Rows are independant of each other and there may be similar quantity values for different parts.

    Even though the range is from B to DX, each row is unique in the total values to be considered (they range from 100+ to 1).

    I was attempting to modify the following code but to no avail:

    =IF(ISERROR(MATCH(0,COUNTIF(A$1:A1,Sheet1!$A$1:$A$ 20&""),0)),"",INDEX(IF(ISBLANK(Sheet1!$A$1:$A$20),"",Sheet1!$A$1 :$A$20),MATCH(0,COUNTIF(A$1:A1,Sheet1!$A$1:$A$20&""),0)))
    Anyway, I am at a loss and need some help. I am attaching a copy of the file as well.

    Thanks,
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    12-17-2007
    Posts
    8
    You can try this:
    http://exceltips.vitalnews.com/Pages...ate_Cells.html

  3. #3
    Registered User
    Join Date
    11-29-2007
    Posts
    3
    Type "the duplicate master" in to Google. It's a very good Excel add-in that I use a lot. Hopefully it will help you do what you need to do.

  4. #4
    Registered User
    Join Date
    07-05-2006
    Posts
    59
    Quote Originally Posted by ConfusedTech
    That was sort of what I need. I needed something to remove duplicates by row whereas the link (along with all the other examples I found) was to do so by column. Anyway, I just modified it a bit to suit my needs.

    I'll post my modified version for anyone else who might need by row versus by column.

    Sub DelDups()
    
        Dim rngSrc As Range
        Dim NumColumns As Integer
        Dim ThisRowumn As Integer
        Dim ThatColumn As Integer
        Dim ThisRow As Integer
        Dim J As Integer, K As Integer, X As Integer
        Dim RowSel As String
    
        Application.ScreenUpdating = False
        
        For X = 1 To 10
        
        RowSel = X & ":" & X
            
        Set rngSrc = ActiveSheet.Range(RowSel)
    
        NumColumns = rngSrc.Columns.Count
        ThisRowumn = rngSrc.Column
        ThatColumn = ThisRowumn + NumColumns - 1
        ThisRow = rngSrc.Row
    
        'Start wiping out duplicates
        For J = ThisRowumn To (ThatColumn - 1)
            If Cells(ThisRow, J) > "" Then
                For K = (J + 1) To ThatColumn
                    If Cells(ThisRow, J) = Cells(ThisRow, K) Then
                        Cells(ThisRow, K) = ""
                    End If
                Next K
            End If
        Next J
    
        'Remove cells that are empty
        For J = ThatColumn To ThisRowumn Step -1
            If Cells(ThisRow, J) = "" Then
                Cells(ThisRow, J).Delete Shift:=xlToLeft
            End If
        Next J
        
        Next X
        
        Application.ScreenUpdating = True
    
    
    End Sub
    If anyone uses this, for reference note the following portion:

    For X = 1 To 10
        
        RowSel = X & ":" & X
    You can change the 1 to 10 to suit the rows needed.


    As far as The Duplicate Master goes, that worked as well (I tried both) and I am putting up the link I found it at for others.

    http://members.iinet.net.au/~brettdj/


    Thanks to both of you for your help.

+ 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