View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.newusers,microsoft.public.excel.worksheet.functions
T. Valko T. Valko is offline
external usenet poster
 
Posts: 15,768
Default EXTRACTING UNIQUE RECORD BASED ON CONDITION

Try this:

Assume the range of data is A2:B21

Enter this array** formula in C2 and copy down until you get #NUM! errors meaning all uniques have been extracted:

=INDEX(B$2:B$21,SMALL(IF(A$2:A$21="AP",IF(B$2:B$21 <"",IF(MATCH(A$2:A$21&B$2:B$21,A$2:A$21&B$2:B$21, 0)=ROW(B$2:B$21)-ROW(B$2)+1,ROW(B$2:B$21)-ROW(B$2)+1))),ROWS($1:1)))

** array formulas *MUST* be entered using the key combination of CTRL,SHIFT,ENTER (not just ENTER)

Biff
"SSJ" wrote in message ...
Hello everyone!

I would like to extract unique records based on a condition. For example, how to extract unique record from column 'B' when column 'A' has "AP" or any other desired condition.

The data is as follows:

A B
MI 70056542
MI 70056543
AP PATRICK CUDAHY INCORPORATED
AP PATRICK CUDAHY INCORPORATED
AP SUGAR CREEK PACKING CO
AP SUGAR CREEK PACKING CO
AP VICTORYS KITCHEN
AP VICTORYS KITCHEN
AP BRIGHT CHEESE HOUSE
AP BRIGHT CHEESE HOUSE
AP CAPPOLA FOODS INC


The final result should look like this:

C
PATRICK CUDAHY INCORPORATED
SUGAR CREEK PACKING CO
VICTORYS KITCHEN
BRIGHT CHEESE HOUSE
CAPPOLA FOODS INC


Thanks
SJ