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

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Try

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

Confirmed with Ctrl+Shift+Enter instead of just Enter.
 
Upvote 0
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
 
Upvote 0
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
 
Upvote 0
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
 
Upvote 0

Forum statistics

Threads
1,214,684
Messages
6,120,874
Members
448,993
Latest member
InquisitiveFrog

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
Back
Top