Formula to extract unique values to an array

  • Thread starter Thread starter QB
  • Start date Start date

QB

Board Regular
Joined
Jul 5, 2004
Messages
93
Hi

I have a column A1 to A750 with many duplicated values. I need a formula to extract the unique values from this column to an array. I want to use the array to act as a data validation list.

I would like to avoid using advanced filtering if possible.

Any help would be much appreciated.

QB
 
Note:

In case there are blank cells in the list, we have to exclude them.

In this case, replace the formula in B2 with:

=IF(ROWS($B$1:B2)>$C$1,"",INDEX(A:A,MIN(IF($A$2:$A$750<>"",IF(ISNA(MATCH($A$2:$A$750,$B$1:B1,0)),ROW($A$2:$A$750))))))

... confirmed with CSE
 
Upvote 0

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Hi

Thanks for your response. I have tried it out but there seems to be a problem. Cell B1 entered as an array formula returns the number of unique values in the range. Cell B2 and the cells below return no value.

I have tried to trace the problem without success. I can see that the name Rvec and cell B1 do seem to generate arrays with the what look like a partial solution. After that I'm stuck - though the reference to cell $C$4 in the formula in B2 does confuse me.

I do hope that you can help me again.

Regards

QB

The formula in B2 refers to a wrong cell. It should be:

Control+shift+enter (not just enter) and copy down...
Rich (BB code):
=IF(ROWS($B$2:B2)<=$B$1,INDEX($A$1:$A$750,
   SMALL(IF(FREQUENCY(IF($A$1:$A$750<>"",
    MATCH("~"&$A$1:$A$750&"",$A$1:$A$750&"",0)),Rvec),Rvec),
      ROWS($B$2:B2))),"")
 
Upvote 0
Thanks to all who helped. The final suggestion worked but I decided to take your advice and use the Advance Filter in the end.

Regards

QB
 
Upvote 0

Forum statistics

Threads
1,226,117
Messages
6,189,068
Members
453,524
Latest member
AshJames

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