Unique values with Formula NOT Macro

MDX2013

New Member
Joined
Jan 2, 2018
Messages
8
I have a column of values. Some are duplicate, some are not. I need a formula to return only unique values without blank cells in the column. See example below.

Raw datacurrent outputdesired output
aaa
ab
bbc
cc
c

<tbody>
</tbody>


Edit:
I should also mention that I am creating a template. Therefore, I do not want to use the "remove duplicates" button or any other solution that involves the user.
 
Last edited by a moderator:

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
Hi, welcome to the forum.

Couple of options, one is an array which requires ctrl+shift+enter to confirm, the other is normal function which can just be entered


Book1
ABC
1ListUniqueUnique CSE
2aca
3abb
4aac
5b
6b
7c
8c
9c
Sheet2
Cell Formulas
RangeFormula
B2=IFERROR(LOOKUP(2,1/(COUNTIF($B$1:B1,$A$2:$A$9)=0),$A$2:$A$9), "")
C2{=IFERROR(INDEX($A$2:$A$9, MATCH(0, COUNTIF($C$1:C1, $A$2:$A$9), 0)), "")}
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0
A
B
1
aa
2
b
3
ac
4
5
b
6
7
b
8
9
c
10
11
c

<tbody>
</tbody>

b1=IFERROR(INDEX($A$1:$A$11,SMALL(IF(FREQUENCY(IF($A$1:$A$11<>"",MATCH($A$1:$A$11,$A$1:$A$11,0)),ROW($A$1:$A$11)-ROW($A$1)+1),ROW($A$1:$A$11)-ROW($A$1)+1),ROWS($A$1:A1))),"")

control+shift+enter copy down
 
Last edited:
Upvote 0
Worked perfectly!!

Now I just have to find a formula to get the data in a new column with it sorted ascending.

Also, what formula would I use to create a new column with two rows between values? Example:
AA
B
C
B
C

<tbody>
</tbody>

<tbody>
</tbody>
 
Upvote 0
Perhaps this will get you started


Book1
AB
1ListUnique Sorted
2JohnAndrew
3Ian
4AndrewBill
5Bill
6BillColin
7Bill
8ColinFrank
9Colin
10FrankIan
11
12John
Sheet1
Cell Formulas
RangeFormula
B2{=IFERROR(IF(MOD(ROW(), 2)=0, INDEX($A$2:$A$10, MATCH(SMALL(IF(COUNTIF($B$1:B1, $A$2:$A$10)=0, COUNTIF($A$2:$A$10, "<"&$A$2:$A$10), ""), 1), COUNTIF($A$2:$A$10, "<"&$A$2:$A$10), 0)), ""), "")}
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0
This works fantastic! But one small issue. I don't always know how long my data is going to be. It could go to A10 or A99. But if i change the range to A99 with empty cells, it messes the formula up.
 
Upvote 0
You would definitely be better with a helper cell/column. But...


Book1
AB
1ListUnique Sorted
2JohnAndrew
3Ian
4AndrewBill
5Bill
6BillIan
7Bill
8John
Sheet1
Cell Formulas
RangeFormula
B2{=IFERROR(IF(MOD(ROW(), 2)=0, INDEX($A$2:INDEX(A:A, MATCH("zzz", A:A)), MATCH(SMALL(IF(COUNTIF($B$1:B1, $A$2:INDEX(A:A, MATCH("zzz", A:A)))=0, COUNTIF($A$2:INDEX(A:A, MATCH("zzz", A:A)), "<"&$A$2:INDEX(A:A, MATCH("zzz", A:A))), ""), 1), COUNTIF($A$2:INDEX(A:A, MATCH("zzz", A:A)), "<"&$A$2:INDEX(A:A, MATCH("zzz", A:A))), 0)), ""), "")}
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0

Forum statistics

Threads
1,215,029
Messages
6,122,755
Members
449,094
Latest member
dsharae57

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