Delete duplicate words from last row in worksheet

Gogleguy

New Member
Joined
Feb 8, 2023
Messages
11
Office Version
  1. 365
Platform
  1. Windows
I have data as shown below. The LAST ROW has duplicate values in few columns (D, E, F, G) separated by line break. I want delete the duplicate value and retain only 1 value in the row.
The generic solution would be that macro deletes everything after line break in the last row cells . Please help.


tom.peter@info.comTOMEnglishJack Barn
Jack Barn
Jack
Jack
jack.barn@info.com
jack.barn@info.com
Read/Complete
Read/Complete
Incomplete - Overdue41
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
If you want the results in a new row, you can use:

Code:
=LEFT(D5,FIND(CHAR(10),D5))

If you want to have the results change the cell(s), you would need to use VBA.
 
Upvote 0
A possible macro (no error checking; i.e., there must be a break on each of those cells) that replaces the last row:

Code:
Sub Removedup()
Dim lr As Long
lr = Cells(Rows.Count, "A").End(xlUp).Row
Cells(lr, "D") = Left(Cells(lr, "D"), InStr(1, Cells(lr, "D"), Chr(10)) - 1)
Cells(lr, "E") = Left(Cells(lr, "E"), InStr(1, Cells(lr, "E"), Chr(10)) - 1)
Cells(lr, "F") = Left(Cells(lr, "F"), InStr(1, Cells(lr, "F"), Chr(10)) - 1)
Cells(lr, "G") = Left(Cells(lr, "G"), InStr(1, Cells(lr, "G"), Chr(10)) - 1)
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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