how to compare cells

L

Legacy 4302

Guest
Hi all
how can I count the number of times data appears in the same column of 2
different rows like:

A1:Z1 and A2:Z2

each time the data appears in the same column it would count as "1"

any ideas??

Thanks

lneilson
 

Some videos you may like

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce

NBVC

Well-known Member
Joined
Aug 31, 2005
Messages
5,828
Try

=SUM(IF(A1:Z1=A2:Z2,1,0))

Confirmed with Ctrl+Shift+Enter instead of just Enter.
 
L

Legacy 4302

Guest
still trying

=SUM(IF(A1:Z1=A2:Z2,1,0))

thanks for the reply I'm still trying to make this work however it
compares the entire range not individual cells

thanks again

lneilson
 

NBVC

Well-known Member
Joined
Aug 31, 2005
Messages
5,828
Did you make sure to evaluate the formula using CTRL + SHIFT + ENTER instead of just enter.

Your formula should be encloded in curly parentheses { }. If not, go to the cell containing the formula, press F2 so that the cursor appears at the end of the formula and try the CSE key combo again.

If this still doesn't get what you want, then please post a sampling of your data to compare and the result you expect, with any further clarifications.

This is how I interpreted your request:
Book1
ABCDE
1dogcatcowcateel
2dogdogcowcatfish
3
4Count:3
Sheet4


dog, cow and cat are repeated in rows 1 and 2 within same column. Therefore count = 3
 

erik.van.geit

MrExcel MVP
Joined
Feb 1, 2003
Messages
17,832
Hi, lneilson,

not an expert like Aladin but I would use something like this
Code:
A4 =SUMPRODUCT(--($A$1:$I$1=$A$2:$I$2))
A5 =SUMPRODUCT(--($A$1:$I$1=$A$2:$I$2),--NOT(ISBLANK($A$1:$I$1)),--NOT(ISBLANK($A$2:$I$2)))
EDIT:
Code:
A5 =SUMPRODUCT(--($A$1:$I$1=$A$2:$I$2),--($A$1:$I$1<>""),--($A$2:$I$2<>""))
Map3.xls
ABCDEFGHI
1abcdhghi
2afffhffi
3
44
53
result

kind regards,
Erik
 

Watch MrExcel Video

Forum statistics

Threads
1,119,265
Messages
5,577,088
Members
412,764
Latest member
Brawler
Top