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
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off

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
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,163,537
Messages
5,832,310
Members
430,128
Latest member
ojl987

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top