Need a formula to remove duplicates from a list, and sort alphabetically

freeb1893

Board Regular
Joined
Jul 30, 2012
Messages
233
Office Version
  1. 365
Platform
  1. Windows
I have a list of words in array O2:O300 where I want to remove duplicates and sort the new list alphabetically starting in cell A1. Anyone know how to put this into a formula?
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
=IFERROR(INDEX(list1,MATCH(MIN(IF(ISBLANK(list1),"",IF(COUNTIF($P$1:P1,list1)=0,1,MAX((COUNTIF(list1,"<"&list1)+1)*2))*(COUNTIF(list1,"<"&list1)+1))),IF(ISBLANK(list1),"",COUNTIF(list1,"<"&list1)+1),0)),"")

list1 is the name of the range you chose.

make sure that $P$1:P1 depends on which column you enter the formula in, if you enter the formula in column B, it should be $B$1:B1


just copy the formula down

FYI: it will be slow if it's a long list, just be patient
 
Upvote 0
It doesn't seem to be working. It just lists 0's in each cell that I drag the formula down into.
list1 is the name of the range you chose.

make sure that $P$1:P1 depends on which column you enter the formula in, if you enter the formula in column B, it should be $B$1:B1


just copy the formula down

FYI: it will be slow if it's a long list, just be patient
 
Upvote 0
Did you try the formula that was in the link in post #2 above? It seems to do what you want (see example from video below).
Also, if you have a later ver. of Excel why not just copy the list to column A use remove duplicates from the menu under DATA and then sort.

Drag formula down as needed.
NOTE: This is an array formula and must be entered with CTRL-SHIFT-ENTER.

Excel Workbook
ABNOP
1Unique Sorted ListList With Dups and Not Sorted
2ChinJo
3JoJoe
4JoeSioux
5JohnChin
6SiouxSioux
7Jo
8Chin
9John
10
11
Sheet2
 
Upvote 0
Same issue. Formula just returns 0 for each cell.
Did you try the formula that was in the link in post #2 above? It seems to do what you want (see example from video below).
Also, if you have a later ver. of Excel why not just copy the list to column A use remove duplicates from the menu under DATA and then sort.

Drag formula down as needed.
NOTE: This is an array formula and must be entered with CTRL-SHIFT-ENTER.

Sheet2

*ABNOP
1Unique Sorted List**List With Dups and Not Sorted*
2Chin**Jo*
3Jo**Joe*
4Joe**Sioux*
5John**Chin*
6Sioux**Sioux*
7***Jo*
8***Chin*
9***John*
10*****
11*****

<COLGROUP><COL style="WIDTH: 30px; FONT-WEIGHT: bold"><COL style="WIDTH: 140px"><COL style="WIDTH: 64px"><COL style="WIDTH: 64px"><COL style="WIDTH: 155px"><COL style="WIDTH: 64px"></COLGROUP><TBODY>
</TBODY>

Spreadsheet Formulas
CellFormula
A2{=IFERROR(INDEX($O$2:$O$300,MATCH(0,COUNTIF($O$2:$O$300,"<"&$O$2:$O$300)-SUM(COUNTIF($O$2:$O$300,$A$1:A1)),0)),"")}

<TBODY>
</TBODY>
Formula Array:
Produce enclosing
{ } by entering
formula with CTRL+SHIFT+ENTER!

<TBODY>
</TBODY>


Excel tables to the web >> Excel Jeanie HTML 4
 
Upvote 0
You need to post a small sample of your data so we can see what you are dealing with.
 
Upvote 0
You need to post a small sample of your data so we can see what you are dealing with.

I am having the same issues, well a little different. It appears to be sorting correctly, besides the 35A-35D being at the beginning but i can live with that. But my problem is that values are missing such as 66 and 99. Any help would be greatly appreciated!

My formula in sorted column is
Code:
=INDEX(nn,MATCH(0,COUNTIF(nn,"<"&nn)-SUM(COUNTIF(nn,$G$3:G3)),0))
Where nn is a dynamic range for the sorted column.

Unsorted is Column F Row 3 and Sorted is Column G Row 3.

UnsortedSorted
3.0035A
5.0035B
9.0035C
12.0035D
17.003.00
32.005.00
50.009.00
18.0012.00
35A17.00
35B18.00
84.0020.00
17.0022.00
35C30.00
49.0032.00
66A48.00
99A49.00
30.0050.00
48.0051.00
55.0055.00
66B60.00
127.0084.00
22.00127.00
35D#N/A
51.00#N/A
66C#N/A
99B#N/A
1.00#N/A
3.00#N/A
5.00#N/A
9.00#N/A
17.00#N/A
32.00#N/A
50.00#N/A
60.00#N/A
1.00#N/A
3.00#N/A
5.00#N/A
9.00#N/A
17.00#N/A
20.00#N/A
32.00#N/A
48.00#N/A
60.00#N/A
9.00#N/A
17.00#N/A
20.00#N/A
32.00#N/A
48.00#N/A
1.00#N/A
3.00#N/A
5.00#N/A
9.00#N/A
17.00#N/A
32.00#N/A
50.00#N/A
1.00#N/A
3.00#N/A
5.00#N/A
9.00#N/A
17.00#N/A
32.00#N/A
48.00#N/A
#N/A
#N/A
#N/A
#N/A
#N/A
#N/A
#N/A
#N/A
#N/A
#N/A
#N/A
#N/A
#N/A
#N/A
#N/A
#N/A
#N/A
#N/A
#N/A
#N/A
#N/A
#N/A

<tbody>
</tbody>

<tbody>
</tbody>
 
Upvote 0
So i have determined that the above code does work, but the 35A, 35B, etc is causing issues with the formula. I could change the 35A to 35.001 to fix it, but that would not be a preferred solution.
 
Upvote 0

Forum statistics

Threads
1,215,514
Messages
6,125,269
Members
449,219
Latest member
daynle

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