# Formula to sort column alphabetically while removing duplicates

#### Lisa116

##### New Member
Hi all,
In sheet1, I have a column with company names listed multiple times and I need to show the company names in sheet2 by alphabetical order in one row with each company listed in a separate column, up to 10 columns. I made the column that the names are in a table (table3) and used countif to get a unique count on sheet2 shown here: =INDEX(table3,MATCH(0,INDEX(COUNTIF(\$S\$11:U11,table3),),0)). This works well until sheet1 is sorted, then the company names in the columns move around. The names need to be fixed on Sheet2 because there's other data below the company name in each column that correspond to each company.

Thanks,
LK

### Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.

#### Fluff

##### MrExcel MVP, Moderator
I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

If you have 365 with the sort function how about
+Fluff 1.xlsm
ABCDEFGHIJKL
1
3West Yorkshire
4Derbyshire
5West Yorkshire
6West Yorkshire
7Lancashire
8West Yorkshire
9County Durham
10Devon
11County Durham
12North Yorkshire
13West Yorkshire
14South Yorkshire
15Staffordshire
16North Yorkshire
17West Yorkshire
18
Main
Cell Formulas
RangeFormula
D2:L2D2=SORT(TRANSPOSE(UNIQUE(B2:B17)),,,1)
Dynamic array formulas.

#### Lisa116

##### New Member
Fluff,
Thank you on both accounts. I have updated my account and the formula works like a charm. Thanks again!!
LK

#### Fluff

##### MrExcel MVP, Moderator
You're welcome & thanks for the feedback & updating your profile.

Replies
4
Views
396
Replies
5
Views
134
Replies
26
Views
493
Replies
3
Views
570
Replies
2
Views
476

1,137,124
Messages
5,679,743
Members
419,854
Latest member
marvin24

### 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.

### Which adblocker are you using?

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

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