Delete a row and keep the other one.

BittenApple
BronzeLounger
Posts: 1498
Joined: 01 Mar 2015, 02:03

Delete a row and keep the other one.

Post by BittenApple »

Hello team,
I have rows in Excel that are identical except one column.
it is like this:

Diagcode Num
Diagcode1 1
Diagcode1 2
Diagcode2 45
Diagcode2 46



Nums for row are different only by one digit. How can I keep row2 and delete row1. If I eyeball it, I am afraid errors might happen since the worksheet has many rows.

Please advise me.

Regards,
Blue
I need to delete the first and keep the second.

User avatar
HansV
Administrator
Posts: 78471
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Delete a row and keep the other one.

Post by HansV »

Step 1:

On the Data tab of the ribbon, click the Sort button.
Add the Diagcode column, then add the Num column, and specify that Num should be sorted Largest to Smallest:

S0433.png

Click OK.

Step 2:

On the Data tab of the ribbon, click Remove Duplicates.
Select ONLY the Diagcode column:

S0434.png

Click OK.

Step 3:

Check the result carefully. If it isn't what you wanted, you can undo the removal (Ctrl+Z).
You do not have the required permissions to view the files attached to this post.
Best wishes,
Hans

BittenApple
BronzeLounger
Posts: 1498
Joined: 01 Mar 2015, 02:03

Re: Delete a row and keep the other one.

Post by BittenApple »

Hello Hans,
I don't have duplicate rows, but I have rows that in one column, the num is different than the num in the next row by one digit.
I want to keep the row that has upper digit.
Regards,
blue blue

User avatar
HansV
Administrator
Posts: 78471
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Delete a row and keep the other one.

Post by HansV »

In your first post, you wrote "I have rows in Excel that are identical except one column.", and now "I don't have duplicate rows".
Which is it?
Best wishes,
Hans

BittenApple
BronzeLounger
Posts: 1498
Joined: 01 Mar 2015, 02:03

Re: Delete a row and keep the other one.

Post by BittenApple »

Hello Hans,
The rows are identical except column. I want to keep second row and delete the other one.
Regards,
Tea

User avatar
HansV
Administrator
Posts: 78471
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Delete a row and keep the other one.

Post by HansV »

OK, so you can use Remove Duplicates, as described in my first reply. Select any of the columns that has duplicates in the dialog.
Best wishes,
Hans

BittenApple
BronzeLounger
Posts: 1498
Joined: 01 Mar 2015, 02:03

Re: Delete a row and keep the other one.

Post by BittenApple »

Hello Hans,
I eyeballed it, it worked; I remember I had this case before and you gave me a solution.
Systems generate reports such as this:
HospitalA Num1
AA 45
HospitalA
AA 46

I needed to keep the second row only.
Respectfully,
Green Tea