View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Max
 
Posts: n/a
Default comparing tables/vectors

Assuming the elements are listed in cols A and B,
with col B's items within say, B1:B100

Put in the formula bar for say, C1,
then array-enter the formula (i.e. press CTRL+SHIFT+ENTER):

=SUMPRODUCT(--ISNUMBER(MATCH(TRANSPOSE(B1:B100),A:A,0)))

Adapt the range to suit ..

--
Rgds
Max
xl 97
---
Singapore, GMT+8
xdemechanik
http://savefile.com/projects/236895
--
"Uka P." wrote in message
...
Hi there :-)


I have two columns with numeric data [but the kind of data shouldn't
matter, I suppose]. They're of _different_ lenght, but there are empty
cells below both of them.
I want to compare the columns and get the _number_ [amount] of mutual
elements as a result.

Ie.: if A={2, 3, 5, 7, 9, 23, 25, 46}, and
B={1, 3, 4, 6, 7, 8, 9, 46}
than Result=4



If I defined the columns to have the same lenght [including some of the
empty cells below] would the empty cells be counted as well? I wouldn't
like that :-)

Thanks in advance, regards.

--
Uka P.