RobbieC
Active Member
- Joined
- Dec 14, 2016
- Messages
- 376
- Office Version
- 2010
- Platform
- Windows
Hi there, I have a sheet with multiple rows and 5 columns:
A...... B......C......D.....E
DATA MB02 7.25 305 X (remove)<remove<remove< font="">
DATA MB02 9.45 305 X (remove)
<remove< font=""> <remove
DATA MB02 20.00 305 X
DATA MB02 15.00 250 X<remove <remove<="" font=""> (remove)
DATA MB02 27.00 250 X
DATA MB02 40.00 150 X
DATA MB03 7.25 305 X
I need to remove the rows with duplicates in column B & D (305 & 250) BUT leave the row with the largest entry in column C (20.00 & 27.00)
I can remove identical rows using:
but I don't know how to the same with looking just at column B and D (both the same) and largest value in column C
If you can point me in the right direction, I'd be most grateful
Thanks</remove></remove
</remove<></remove<remove<>
A...... B......C......D.....E
DATA MB02 7.25 305 X (remove)<remove<remove< font="">
DATA MB02 9.45 305 X (remove)
<remove< font=""> <remove
DATA MB02 20.00 305 X
DATA MB02 15.00 250 X<remove <remove<="" font=""> (remove)
DATA MB02 27.00 250 X
DATA MB02 40.00 150 X
DATA MB03 7.25 305 X
I need to remove the rows with duplicates in column B & D (305 & 250) BUT leave the row with the largest entry in column C (20.00 & 27.00)
I can remove identical rows using:
Code:
Dim MyRange As Range
lastrow = Sheets("DataSheet").Range("A" & Rows.Count).End(xlUp).Row
Set MyRange = Sheets("DataSheet").Range("A1:E" & lastrow)
'remove duplicate rows if filename matches
MyRange.RemoveDuplicates Columns:=Array(1, 2, 3, 4, 5)
but I don't know how to the same with looking just at column B and D (both the same) and largest value in column C
If you can point me in the right direction, I'd be most grateful
Thanks</remove></remove
</remove<></remove<remove<>
Last edited: