Getting Unique Values from List without VBA

Hazelwood

New Member
Joined
Feb 25, 2018
Messages
13
Hi, I'm using Excel (Microsoft 365 on a Mac)

I'm using the formula

=IFERROR(INDEX($B$2:$B$9, MATCH(0,COUNTIF($D$1:D1, $B$2:$B$9), 0)),"")

B1 = Fruit, B2 etc = Apple, Orange, Apple, Banana, Banana, Apple, Pineapple, Peach
D1 = Unique, D2 has the above formula

I copied the example from https://www.extendoffice.com/ into my spreadsheet (will convert to my application once it works)

When I use the formula builder, it shows the result as expected (D2 being Apple, but in my spreadsheet it only shows a blank - I'm stumped as to how to get it to show the first unique value and subsequent values.

Any ideas would be be much appreciated... Hazelwood
 

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
To list the unique items in the order they appear in the list, enter this array formula in cell D2 and copy down as needed:
Code:
=INDEX($B$2:$B$9,MATCH(0,COUNTIF($D$1:D1,$B$2:$B$9),0))

To list the unique items in alphabetical order, enter this array formula in cell D2 and copy down as needed:
Code:
=INDEX($B$2:$B$9,MATCH(0,COUNTIF($B$2:$B$9,"<"&$B$2:$B$9)-SUM(COUNTIF($B$2:$B$9,"="&D$1:D1)),0))

Note that these are ARRAY formulas. You confirm them to the cell by pressing Ctrl+Shift+Enter, not just with Enter.
 
Last edited:
Upvote 0
To list the unique items in the order they appear in the list, enter this array formula in cell D2 and copy down as needed:
Code:
=INDEX($B$2:$B$9,MATCH(0,COUNTIF($D$1:D1,$B$2:$B$9),0))

To list the unique items in alphabetical order, enter this array formula in cell D2 and copy down as needed:
Code:
=INDEX($B$2:$B$9,MATCH(0,COUNTIF($B$2:$B$9,"<"&$B$2:$B$9)-SUM(COUNTIF($B$2:$B$9,"="&D$1:D1)),0))

Note that these are ARRAY formulas. You confirm them to the cell by pressing Ctrl+Shift+Enter, not just with Enter.

Tom, much appreciated, have a great day ... Hazelwood
 
Upvote 0

Forum statistics

Threads
1,214,983
Messages
6,122,591
Members
449,089
Latest member
Motoracer88

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