View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
TroyW TroyW is offline
external usenet poster
 
Posts: 32
Default Unique Records by Field

Here is a formula that doesn't require the intermediate calculation.

You will need to adjust:
$A$1, $B$1, $C$1 values in the formula to reflect the top row of your
range.
$A$9, $B$9, $C$9 values in the formula to reflect the bottom row of your
range.

Your choice on which formula is easier to maintain.

Troy

(watch for word wrap)

D1:
=IF(SUMPRODUCT((A1:$A$9=A1)*(B1:$B$9=B1)*(C1:$C$9= C1))=SUMPRODUCT(($A$1:$A$9
=A1)*($B$1:$B$9=B1)*($C$1:$C$9=C1)),1,0)


"TroyW" wrote in message
...
Another possibility. If you want to add an intermediate calculation you

can
accomplish the desired result with a formula. Cell E1 will calculate = 1,
cell E2 will calculate = 0. If you have errors in any of the cells, then a
more robust formula would be needed.

Troy

A1: Peters
B1: 04/05/2003
C1: 2
D1: =A1&B1&C1
E1: =IF(COUNTIF(D$1:D1,D1)=1,1,0)

A2: Peters
B2: 04/05/2003
C2: 2
D2: =A2&B2&C2
E2: =IF(COUNTIF(D$1:D2,D2)=1,1,0)


"Indu Aronson" wrote in message
...
I have a list with 9 fields. There are three fields --
Last, Date, and Code -- that are important. Many of these
fields repeat -- e.g. Peters, 04/05/2003, 2 -- but when
they are unique I would like to place a 1 in a fourth
field called Unique. Thus if the above data is repeated
over 10 rows -- there would be one entry which has a 1 and
the others would have a blank or 0. If the 11th record was
Hobbs, 04/05/2003, 2 then there would be a 1 in the Unique
field as at least one field has changed.

I have done this with Advanced filter. But does someone
know a way to do it through code?

Thanks for any help.

Indu