Dynamically delete duplicate rows - leave no gaps

dslhs

New Member
Joined
Apr 4, 2022
Messages
42
Office Version
  1. 2019
Platform
  1. Windows
Hi,

I have a table (A2 = Names, B2 = Courses). There are multiple duplicate rows - where the information in both the A column and B column are exactly the same. I would like to re-create the table, but without any duplicate rows. There will be duplicates in the A column, and in the B column, but I don't want there to be A&B. I'd also like the new linked table to have no row gaps.

I know I can Go to the Data tab > Data Tools group, and click the Remove Duplicates, but I'd like this to be dynamic as the table is linked to external data.

I don't have the 'Unique' function, as I'm in 2019.

Many thanks,
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
you can do this in power query which is part of your version and called Get and Transform Data.

 
Upvote 0
Not sure how? Would this be dynamic as the data changes frequently? Thanks
 
Upvote 0
the simple answer is yes. However, if you would like to see this in a demo, suggest you upload some sample data and a mocked up solution. Use XL2BB to do this. Do not load a picture as we can not manipulate data in a picture.
 
Upvote 0
Thanks. Below is a mini-sheet with anonymised details. Essentially, I want to dynamically recreate the table (A2:B31) in columns D and E, but without duplicate rows. So for example, row 7,. 11, and 12 wouldn't be copied over as they are a duplicate row with row 5 (both student and course). Thanks


Book1
ABCDE
2NameCourse/Class NameNameCourse/Class Name
3Student A45C/Life Skills
4Student AMathematics
5Student AKS45
6Student APhysical Education
7Student AKS45
8Student A45C/PE
9Student ALife Skills
10Student A45C/English
11Student AKS45
12Student AKS45
13Student A45C/Life Skills
14Student BPhysical Education
15Student B45C/Wellbeing
16Student BIT + Computing
17Student B45C/Maths
18Student BIT + Computing
19Student BKS45
20Student BMathematics
21Student BIndependent Living Skills
22Student BOptions 1/ILS
23Student B45C/Health Education
24Student BOptions 2/IT
25Student CKS45
26Student CMathematics
27Student CHealth Education
28Student CMathematics
29Student CEnglish
30Student CIT + Computing
31Student CComputing
32
Class List
 
Upvote 0
Here is the Mcode. I imported your file to Power Query. Highlighted the two columns and clicked on Remove Rows-->Remove Duplicates.

Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Removed Duplicates" = Table.Distinct(Source)
in
    #"Removed Duplicates"
 
Upvote 0
Solution
Brilliant. Got that to work.

While I have you... how would I do the same but only remove duplicates values from a column in power query. Specifically the second column titled 'Course/Class Name' for a Table called 'Courses'.

Many thanks,
 
Upvote 0
I'm not understanding your needs. Suggest you upload a sample and a mocked up solution. so that I have a better understanding.
 
Upvote 0
I'd like it so all the duplicates (e.g. KS3) in column F are removed - but dynamically as the source is external data that updates regularly. Where before I was looking to remove duplicate rows, I'm now looking to remove duplicates within a column please.

Thanks!

Book2
EF
2Parent CourseCourse/Class Name
3Mathematics
4Computing
5Music
6EHCP Targets
7Engineering
8English
9Physical Education
10Registration
11Relationship + Sex Education
12SaLT and Interpersonal Skills
13Science
14Life Skills
15Drama
16Creative Media
17Food
18Community Skills
19Health Education
20Humanities
21Work/College Experience
22Citizenship
23Alternative Provision
24Horticulture
25Wellbeing
26Future Skills
27Art
28ArtOptions 2/Art
29ArtKS3
30ArtOptions 1/Art
31Art: KS33C/Art
32Art: KS33D/Art
33Art: KS33A/Art
34Art: KS33B/Art
35CitizenshipOptions 1/Citizenship
36Community SkillsKS4
37Community SkillsKS5
38Community SkillsKS45
39Community SkillsKS3
40Community Skills: KS33CD/Community Skills
41Community Skills: KS33AB/Community Skills
42Community Skills: KS44A/Community Skills
43Community Skills: KS44AB/Community Skills
44Community Skills: KS55AB/Community Skills
45Community Skills: KS4545CD/Community Skills
46ComputingKS3
47ComputingOptions 1/Computing
48ComputingIT + Computing
49Computing: IT + ComputingOptions 2/IT
50Computing: KS33C/Computing
51Computing: KS33D/Computing
52Computing: KS33A/Computing
Class List
 
Upvote 0
Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Removed Duplicates" = Table.Distinct(Source, {"Course/Class Name"})
in
    #"Removed Duplicates"
 
Upvote 0

Forum statistics

Threads
1,214,858
Messages
6,121,956
Members
449,057
Latest member
FreeCricketId

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