Merging Similar Rows

MISSUCF

New Member
Joined
Sep 17, 2010
Messages
1
Hey There!<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:eek:ffice:eek:ffice" /><o:p></o:p>
I’m new to the forum and am having a tough time.. I’m pretty proficient in Access, but Excel is a little foreign to me. I have a table that contains simliar (but not duplicate) rows. Is there a filter or macro that would simplify this issue?
IE:
ColA ColB ColC
One xxx xxx
One xxx yyy
Two xxx xxx
Two xxx yyy


and I want it to look like this:
ColA ColB ColC
One xxx xxx
____xxx yyy

Two xxx xxx
____xxx yyy

Thank you for your time and dilligence!! :cool:
 
Last edited:

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
This is a WYRWYG (What You Request is What You Get)
Code:
Sub OneTwo()
With Sheets("Sheet1")
 If .Range("A1").Value = .Range("A2").Value Then
    If .Range("B1").Value = .Range("B2").Value Then
        If .Range("C1").Value = .Range("C2").Value Then
        .Range("A2").ClearContents
End If
End If
End If
 If .Range("A3").Value = .Range("A4").Value Then
    If .Range("B3").Value = .Range("B4").Value Then
        If .Range("C3").Value = .Range("C4").Value Then
        .Range("A4").ClearContents
End If
End If
End If
End With
End Sub

If there's other data then the code will have to be tweaked
 
Upvote 0
If your data goes farther down like to 100 from what I first posted, try this on a copy of your WorkBook
Code:
Sub OneTwo()
Dim i As Long
For i = 1 To 100
With Sheets("Sheet1")
 If .Range("A" & i).Value = .Range("A" & i + 1).Value Then
    If .Range("B" & i).Value = .Range("B" & i + 1).Value Then
        If .Range("C" & i).Value = .Range("C" & i + 1).Value Then
        .Range("A" & i - 1).ClearContents
        .Range("A" & i + 1).ClearContents

         End If
     End If
 End If
 End With
 Next i

End Sub
 
Upvote 0
oops!
Instead
Code:
Sub OneTwo()
Dim i As Long
With Sheets("Sheet1")
For i = 2 To 100
 If .Range("A" & i - 1).Value = .Range("A" & i).Value Then
    If .Range("B" & i - 1).Value = .Range("B" & i).Value Then
        If .Range("C" & i - 1).Value = .Range("C" & i).Value Then
            .Range("A" & i).ClearContents

        End If
    End If
End If
 
 Next i
End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,944
Messages
6,122,387
Members
449,080
Latest member
Armadillos

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top