Remove duplicates & create list

drluke

Active Member
Joined
Apr 17, 2014
Messages
314
Office Version
  1. 365
Platform
  1. Windows
I have a long list with codes in sheet 1 of my data starting at A2 (the list is very long 4500 rows):

[TABLE="class: grid, width: 50"]
<tbody>[TR]
[TD]C56[/TD]
[/TR]
[TR]
[TD]A125[/TD]
[/TR]
[TR]
[TD]R89[/TD]
[/TR]
[TR]
[TD]C56[/TD]
[/TR]
[TR]
[TD]B125[/TD]
[/TR]
[TR]
[TD]B125[/TD]
[/TR]
[TR]
[TD]A125[/TD]
[/TR]
[TR]
[TD]R89[/TD]
[/TR]
[TR]
[TD]D512[/TD]
[/TR]
[TR]
[TD]S226[/TD]
[/TR]
[TR]
[TD]D512[/TD]
[/TR]
[TR]
[TD]R89[/TD]
[/TR]
</tbody>[/TABLE]

In sheet 2 I need to create a list of all the codes and remove the duplicates. I'm using the following array formula to try and do it:

{=INDEX('Sheet 1'!$A$2:$A$4568,MATCH(0,COUNTIF('Sheet 1'!$A$1:A1,'Sheet 1'!$A$2:$A$4568),0))}

The formula results in the 1st and 2nd unique codes to be returned correctly but the 3rd unique code is duplicated for the rest of the lines:

[TABLE="class: grid, width: 50"]
<tbody>[TR]
[TD]Code[/TD]
[/TR]
[TR]
[TD]C56[/TD]
[/TR]
[TR]
[TD]A125[/TD]
[/TR]
[TR]
[TD]R89[/TD]
[/TR]
[TR]
[TD]R89[/TD]
[/TR]
[TR]
[TD]R89[/TD]
[/TR]
</tbody>[/TABLE]

I cannot work out what is wrong with the formula?
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
Maybe,

In "Sheet 2" A2, non-CSE formula copied down :

=IFERROR(INDEX('Sheet 1'!$A$2:$A$4568,MATCH(0,INDEX(COUNTIF('Sheet 2'!$A$1:A1,'Sheet 1'!$A$2:$A$4568&""),0),0))&"","")

Regards
Bosco
 
Upvote 0
Thank you for this. I get the same result as before using this formula.
 
Upvote 0

Forum statistics

Threads
1,224,828
Messages
6,181,209
Members
453,023
Latest member
alabaz

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