View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Mike H Mike H is offline
external usenet poster
 
Posts: 11,501
Default Distinct items from recordset

Hi,

List in data in columns A & B
The will treat the top row as a header row. Select the list of countries and
then

Data|Filter|Advanced filter
Select 'Copy to another location'
Check 'Unique records only'
Click the icon in the 'Copy to' box and select a single cell to copy to
Click the icon again.
OK

You now have a unique list of countries. I copied mine to column M so M2 is
the first country and M1 is the header. Put this in N2 and drag down as far
as required.

=VLOOKUP(M2,$A$2:$B$100,2,FALSE)


--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"IgorM" wrote:

Hi

How to get distinct items from a recordset? Let's assume I have two columns
returned from a database: countries and cities.
I want to retrieve a list of unique country names.


Kind regards
IgorM