Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
DOR DOR is offline
external usenet poster
 
Posts: 11
Default Is there a method to find distinct values in a column

If you want a non-VBA solution that responds immediately to changing
values in your data range, you can create a list of the unique values
by entering the following formula in a cell in another column (assuming
your data range is named Data)

=INDEX($A:$A,SMALL(IF(MATCH(Data,$A:$A,0)=ROW(Data ),ROW(Data),""),ROW(1:1)))

Enter it as an array formula with Ctl-Shift-Enter and drag down as far
as you need to get all unique values. If you drag beyond that point
you will get #NUM errors, which may or may not bother you.

If column A contains other values outside the range Data that interfere
with the above formula, then use this formula

=INDEX(Data,SMALL(IF(MATCH(Data,Data,0)=ROW(INDIRE CT("1:"&ROWS(Data))),ROW(INDIRECT("1:"&ROWS(Data)) ),""),ROW(1:1)))

also entered as an array, and dragged down as far as necessary. This
formula may be longer but it is more reliable, given the potential for
extraneous data in the column.

You can eliminate the #NUM and replace them with blanks with this array
formula

=IF(ROW(1:1)COUNT(IF(MATCH(Data,Data,0)=ROW(INDIR ECT("1:"&ROWS(Data))),ROW(INDIRECT("1:"&ROWS(Data) )),"")),"",INDEX(Data,SMALL(IF(MATCH(Data,Data,0)= ROW(INDIRECT("1:"&ROWS(Data))),ROW(INDIRECT("1:"&R OWS(Data))),""),ROW(1:1))))

or you could simplify the whole thing by using a helper column, say
column B. Put this (non-array) formula in B2, assuming your data
starts in A2,

=IF(COUNTIF($A$2:A2,A2)=1,ROW(),"")

and drag down to the end of your data. Then, in the first cell where
you want the unique list, enter

=IF(ROW(1:1)COUNT(B:B),"",INDEX(A:A,SMALL(B:B,ROW (1:1))))

an drag down as far as necessary.

HTH

Declan O'R

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I get the distinct values in a column & put it in next col VIDYA Excel Discussion (Misc queries) 2 December 22nd 08 06:28 PM
distinct values in column parthaemail New Users to Excel 13 March 13th 06 02:40 PM
How Do I find distinct values in a Column Stankov New Users to Excel 5 September 8th 05 02:52 PM
How Do I find distinct values in a Column Stankov New Users to Excel 1 September 7th 05 03:15 PM
Find method - finding multiple values nathan Excel Programming 6 August 23rd 05 10:13 PM


All times are GMT +1. The time now is 12:50 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"