Merging Data from two rows into one

A

agpphilker

Hi All,
I have a spreadsheet that contains data for the same equipment on two rows. I recieve this spreadsheet monthly and the amount of equipment can change.

The unique identifier is the equipment serial number.

An Example

A B C D
118837 1 500
118837 2 1000

What I want to be able to do is take the 1000 and place it in column D and than delete the remaining data in A2 & B2, this will than drop down next equipment that will have the same format.

Most equipment is entered twice with the serial number in A a 1&2 in B with any number in C, some how ever will only have a 1 and there fore is on the spreadsheet only once.

I hope you can help

Thanks in advanced
 
D

Don Guillett

Hi All,

I have a spreadsheet that contains data for the same equipment on two rows. I recieve this spreadsheet monthly and the amount of equipment can change.



The unique identifier is the equipment serial number.



An Example



A B C D

118837 1 500

118837 2 1000



What I want to be able to do is take the 1000 and place it in column D and than delete the remaining data in A2 & B2, this will than drop down next equipment that will have the same format.



Most equipment is entered twice with the serial number in A a 1&2 in B with any number in C, some how ever will only have a 1 and there fore is on the spreadsheet only once.



I hope you can help



Thanks in advanced

This will do it

Sub tworowstoone()
Dim i As Long
For i = Cells(Rows.Count, 1).End(xlUp).Row To 2 Step -1
If Cells(i - 1, 1) = Cells(i, 1) Then
dc = Cells(i - 1, Columns.Count).End(xlToLeft).Column + 1
Cells(i, Columns.Count).End(xlToLeft).Copy Cells(i - 1, dc)
Rows(i).Delete
End If
Next i
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top