Excel 2007: Delete Duplicate Records, Keep Duplicates Meeting Criteria

CGXLuser

New Member
Joined
Mar 17, 2014
Messages
2
Hi,

I use excel a lot at work and want to start making my job easier. I am trying to learn how to use VBA, but need an answer on this issue sooner than later. I am trying to get data from a report, but I need to delete duplicate records to get accurate information. However, there are some instances where I do need some duplicates if it meets one criteria. My spreadsheet has too much info for me to post it all, so here is an attempt to simplify what it looks like:

Column A (Scheduler) Column B(Course) Column C(Session) Column D(Attendance) Column E(Students)
1 OP1 100 1 Enrolled 3
2 OP1 100 1 Waived 2
3 OP1 100 1 Request 5
4 OP1 101 1 Enrolled 13
5 OP1 101 1 Request 2
6 OP2 200 2 Enrolled 8
7 OP2 200 2 Cancelled 2
8 OP2 200 2 Request 3

So here's what I am looking for:
- I want to delete duplicates and keep one record based on attendance precedence: (1) Enrolled, (2) Waived,(3) Request, (4) Cancelled
- The duplicates should be based on course and session.
- 1,2,3 are duplicates, 4,5 are duplicates, and 6,7,8 are duplicates
- In addition to records with the value "Enrolled," I want to keep any record that also has the value "Waived"

So, my goal is to run a macro (Unless there is a simple task that can do this for me in excel) to make result in the following:

Column A (Scheduler) Column B(Course) Column C(Session) Column D(Attendance) Column E(Students)
1 OP1 100 1 Enrolled 3
2 OP1 100 1 Waived 2
3 OP1 101 1 Enrolled 13
4 OP2 200 2 Enrolled 8

I hope this isn't confusing. Appreciate any assistance!

CGXLuser
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
Sorry for the formatting, this is what I meant to have:

What I see:
[TABLE="width: 700"]
<tbody>[TR]
[TD]Record
[/TD]
[TD]Column A (Scheduler)
[/TD]
[TD]Column B(Course)
[/TD]
[TD]Column C(Session)
[/TD]
[TD]Column D(Attendance)
[/TD]
[TD]Column E(Students)
[/TD]
[/TR]
[TR]
[TD]1
[/TD]
[TD]OP1
[/TD]
[TD]100
[/TD]
[TD]1
[/TD]
[TD]Enrolled
[/TD]
[TD]3
[/TD]
[/TR]
[TR]
[TD]2
[/TD]
[TD]OP1
[/TD]
[TD]100
[/TD]
[TD]1
[/TD]
[TD]Waived
[/TD]
[TD]2
[/TD]
[/TR]
[TR]
[TD]3
[/TD]
[TD]OP1
[/TD]
[TD]100
[/TD]
[TD]1
[/TD]
[TD]Request
[/TD]
[TD]5
[/TD]
[/TR]
[TR]
[TD]4
[/TD]
[TD]OP1
[/TD]
[TD]101
[/TD]
[TD]1
[/TD]
[TD]Enrolled
[/TD]
[TD]13
[/TD]
[/TR]
[TR]
[TD]5
[/TD]
[TD]OP1
[/TD]
[TD]101
[/TD]
[TD]1
[/TD]
[TD]Request
[/TD]
[TD]2
[/TD]
[/TR]
[TR]
[TD]6
[/TD]
[TD]OP2
[/TD]
[TD]200
[/TD]
[TD]2
[/TD]
[TD]Enrolled
[/TD]
[TD]8
[/TD]
[/TR]
[TR]
[TD]7
[/TD]
[TD]OP2
[/TD]
[TD]200
[/TD]
[TD]2
[/TD]
[TD]Request
[/TD]
[TD]3
[/TD]
[/TR]
[TR]
[TD]8
[/TD]
[TD]OP2
[/TD]
[TD]200
[/TD]
[TD]2
[/TD]
[TD]Cancelled
[/TD]
[TD]2
[/TD]
[/TR]
</tbody>[/TABLE]

What I want:
[TABLE="width: 700"]
<tbody>[TR]
[TD]Record
[/TD]
[TD]Column A (Scheduler)
[/TD]
[TD]Column B(Course)
[/TD]
[TD]Column C(Session)
[/TD]
[TD]Column D(Attendance)
[/TD]
[TD]Column E(Students)
[/TD]
[/TR]
[TR]
[TD]1
[/TD]
[TD]OP1
[/TD]
[TD]100
[/TD]
[TD]1
[/TD]
[TD]Enrolled
[/TD]
[TD]3
[/TD]
[/TR]
[TR]
[TD]2
[/TD]
[TD]OP1
[/TD]
[TD]100
[/TD]
[TD]1
[/TD]
[TD]Waived
[/TD]
[TD]2
[/TD]
[/TR]
[TR]
[TD]3
[/TD]
[TD]OP1
[/TD]
[TD]101
[/TD]
[TD]1
[/TD]
[TD]Enrolled
[/TD]
[TD]13
[/TD]
[/TR]
[TR]
[TD]4
[/TD]
[TD]OP2
[/TD]
[TD]200
[/TD]
[TD]2
[/TD]
[TD]Enrolled
[/TD]
[TD]8
[/TD]
[/TR]
</tbody>[/TABLE]


CGXLuser
 
Upvote 0

Forum statistics

Threads
1,223,248
Messages
6,171,011
Members
452,374
Latest member
keccles

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