Hi, I want to remove duplicate data and it is dependent on cell in different column.

akr1903

New Member
Joined
Sep 4, 2021
Messages
2
Office Version
  1. 365
sample sheet.xlsx
ABCD
1CountryEmailApplication StatusInitiated On
2United Kingdomqqqqqqqqqqq@gmail.comSubmitted to University07-23-2021 16:07
3United Kingdomqqqqqqqqqqq@gmail.comNew07-23-2021 16:07
4United Kingdomqqqqqqqqqqq@gmail.comOffer Received (Unconditional)07-23-2021 16:07
5United Kingdomqqqqqqqqqqq@gmail.comSubmitted to 3rd Party04-15-2021 23:04
6United Kingdomqqqqqqqqqqq@gmail.comDeposit Made04-15-2021 23:04
7United Kingdomqqqqqqqqqqq@gmail.comSubmitted to University04-15-2021 23:04
8United Kingdomeeeeeeeeee@gmail.comSubmitted to University05-18-2021 15:05
9United Kingdomeeeeeeeeee@gmail.comApplication Rejected05-18-2021 15:05
10United Kingdomrrrrrrrrrrrrr@gmail.comOffer Received (Unconditional)05-20-2021 13:05
11United Kingdomrrrrrrrrrrrrr@gmail.comInfo required post submission04-19-2021 17:04
12United Kingdomrrrrrrrrrrrrr@gmail.comOffer Received (Conditional)04-19-2021 17:04
13United Kingdomrrrrrrrrrrrrr@gmail.comInfo required post submission04-19-2021 17:04
14United Kingdomaaaaaaaaaa@gmail.comNew08-20-2021 13:08
15United Kingdomaaaaaaaaaa@gmail.comSubmitted to University06-05-2021 11:06
16United Kingdomaaaaaaaaaa@gmail.comApplication Rejected05-21-2021 19:05
17United Kingdomaaaaaaaaaa@gmail.comIn Progress05-21-2021 19:05
18United Kingdomaaaaaaaaaa@gmail.comDeposit Made05-21-2021 19:05
19United Kingdomaaaaaaaaaa@gmail.comSubmitted to University05-21-2021 19:05
20United Kingdomaaaaaaaaaa@gmail.comSubmitted to University05-21-2021 19:05
21United Kingdombbbbbbbbbbbb@gmail.comOffer Received (Conditional)05-18-2021 13:05
22United Kingdombbbbbbbbbbbb@gmail.comSubmitted to University05-18-2021 13:05
23United Kingdomccccccccccccccc@gmail.comNew08-11-2021 13:08
24United Kingdomccccccccccccccc@gmail.comSubmitted to University08-11-2021 13:08
25United Kingdomccccccccccccccc@gmail.comInfo required post submission04-10-2021 15:04
26United Kingdomccccccccccccccc@gmail.comSubmitted to University04-10-2021 15:04
27United Kingdomccccccccccccccc@gmail.comOffer Received (Conditional)04-10-2021 15:04
28United Kingdomddddddddddddd@gmail.comOffer Received (Unconditional)07-28-2021 13:07
29United Kingdomddddddddddddd@gmail.comDeposit Made06-12-2021 12:06
Sheet1
Cells with Conditional Formatting
CellConditionCell FormatStop If True
B1:B29Cell ValueduplicatestextNO
B1:B29Cell Valueunique valuestextNO
B1:B29Other TypeColor scaleNO
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
The places where deposit is made I want all the data in that row, and delete rest rows with similar email address. Eg C6 has deposit made, I want the data in row 6 and rest rows that is row 7, 5,4,3,2 to be removed. In places where no deposit is made I want all the data. Eg for email address eeeeeeeeee@gmail.com, rrrrrrrrrrrrr@gmail.com, bbbbbbbbbbbb@gmail.com and ccccccccccccccc@gmail.com no deposit is made, so I want all the data for those emails.
 
Upvote 0
Welcome to the MrExcel board!

Try this macro with a copy of your workbook.

VBA Code:
Sub RemoveDepositDupes()
  With Range("C2", Range("C" & Rows.Count).End(xlUp))
    .Value = Evaluate(Replace(Replace("if(@<>""Deposit Made"",if(countifs(%,%,@,""Deposit Made""),""#N/A"",@),@)", "@", .Address), "%", .Offset(, -1).Address))
    On Error Resume Next
    .SpecialCells(xlConstants, xlErrors).EntireRow.Delete
    On Error GoTo 0
  End With
End Sub
 
Upvote 0
Nice one! Can be done with names as well, which is easier to read in my opinion.

VBA Code:
Sub RemoveDepositDupes2()
  With Range("C2", Range("C" & Rows.Count).End(xlUp))
    .Name = "b"
    .Offset(, -1).Name = "a"
    .Value = Evaluate("if(b<>""Deposit Made"",if(countifs(a,a,b,""Deposit Made""),""#N/A"",b),b)")
    
    On Error Resume Next
    .SpecialCells(xlConstants, xlErrors).EntireRow.Delete
    On Error GoTo 0
  End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,522
Messages
6,120,025
Members
448,939
Latest member
Leon Leenders

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