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
 

CGXLuser

New Member
Joined
Mar 17, 2014
Messages
2
Sorry for the formatting, this is what I meant to have:

What I see:
Record
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
Request
3
8
OP2
200
2
Cancelled
2

<tbody>
</tbody>

What I want:
Record
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

<tbody>
</tbody>


CGXLuser
 

Forum statistics

Threads
1,081,526
Messages
5,359,280
Members
400,523
Latest member
ExcelNewbie98

Some videos you may like

This Week's Hot Topics

  • VBA (Userform)
    Hi All, I just would like to know why my code isn't working. Here is my VBA code: [CODE=vba]Private Sub OKButton_Click() Dim i As Integer...
  • List box that changes fill color
    Hello, I have gone through so many pages trying to figure this out. I have a 2020 calendar that depending on the day needs to have a certain...
  • Remove duplicates and retain one. Cross-linked cases
    Hi all I ran out of google keywords to use and still couldn't find a reference how to achieve the results of a single count. It would be great if...
  • VBA Copy and Paste With Duplicates
    Hello All, I'm in need of some input. My VBA skills are sub-par at best. I've assembled this code from basic research and it works but is...
  • Macro
    is it possible for a macro to run if the active cell value is different to the value above it
  • IF DATE and TIME
    I currently use this to check if date has passed but i also need to set a time on it too. Is it possible? [CODE=vba]=IF(B:B>TODAY(),"Not...
Top