+ Reply to Thread
Results 1 to 2 of 2

Deleting duplicate rows but preserving & moving one column

Hybrid View

  1. #1
    Registered User
    Join Date
    10-08-2009
    Location
    Ventura, CA
    MS-Off Ver
    Excel 2007
    Posts
    3

    Red face Deleting duplicate rows but preserving & moving one column

    Hi All,

    I would like to know if there is a formula that will remove all duplicate rows. However, there is one column of data that is not duplicated, and I would like to preserve that data and move it into a new row.

    Here is an example:

    12361646 AvisRentACar A 7811 Waynetowne Blvd Dayton OH Restaurants
    12361646 AvisRentACar A 7811 Waynetowne Blvd Dayton OH Auto Rentals
    12361646 AvisRentACar A 7811 Waynetowne Blvd Dayton OH Auto Leasing
    12361646 AvisRentACar A 7811 Waynetowne Blvd Dayton OH Furniture Rental

    to become

    12361646 AvisRentACar A 7811 Waynetowne Blvd Dayton OH Restaurants Auto Rentals Auto Leasing Furniture Rental

  2. #2
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: Deleting duplicate rows but preserving & moving one column

    Assuming that your data has a header row and the column to move is E then the following macro should work.

    Sub Test()
    For N = Cells(Rows.Count, 1).End(xlUp).Row To 2 Step -1
        If Cells(N, 1) = Cells(N - 1, 1) Then
            FirstRow = Columns(1).Find(Cells(N, 1), Cells(1, 1), xlValues, xlWhole).Row
            Cells(FirstRow, Columns.Count).End(xlToLeft).Offset(0, 1) = Cells(N, 5)
            Rows(N).Delete
        End If
    Next N
    End Sub
    Martin

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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