Finding data criteria to mark for deletion

pbutcheck

New Member
Joined
Jul 22, 2015
Messages
21
Office Version
  1. 2016
  2. 2013
Platform
  1. Windows
Hello geniuses. I'm back with the same project that has been haunting my office for several weeks. This time, with a new twist. Now my team wants to remove data from an extremely large collection of billing records. The goal is to remove/mark the rows of data that are involved with the FIRST billing of every occurrence, but keep (and tally) all subsequent billing occurrences. The trick? If the first billing was split into two service bills, we need to delete both of those rows.

Example: Patti was billed on June 1st for the SAME service, but they split the service up into two line entry items. We want to remove the first billing (only), leaving only the June 5th bill. Because the first two rows have the same name and date, we can treat these rows as one entry and mark for deletion.

John, however, was billed on May 1st - and we only need to remove the 5/1 row (keeping 7/8 and 8/5).

Kelly was billed for one service on 1/1, but we need to remove the two rows of data from our list.

Patti 6/1/2015 delete
Patti 6/1/2015 delete
Patti 6/5/2015 keep
John 5/1/2015 delete
John 7/8/2015 keep
JOhn 8/5/2015 keep
Kelly 1/1/2015 delete
Kelly 1/1/2015 delete
Kelly 5/1/2015 keep
Kelly 5/4/2015 keep

The goal is to remove every occurrence of the FIRST billing (some of which will be two rows of data, united by a common billing date). I thought I could use a nested IF (AND) statement, but I'm failing to generate the logic to compare the first occurrence against the next row successfully. Then I planned to mark a 3rd column in some fashion so that we could tally the rows for deletion, as well as sorting / deleting those rows.

Any advice would be greatly appreciated!!
 
Last edited:

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
Maybe this

Array formula in C1 copied down
=IF(COUNTIF(A:A,A1)=1,"keep",IF(B1=MIN(IF($A$1:$A$10=A1,$B$1:$B$10)),"delete","keep"))

confirmed with Ctrl+Shift+Enter, not just Enter

Hope this helps

M.
 
Upvote 0

Forum statistics

Threads
1,223,243
Messages
6,170,967
Members
452,371
Latest member
Frana

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