简体   繁体   中英

How can I count how many cells are the same in both rows?

I'm currently struggling with something that seems to me like it should be quite simple. I have the following two rows in a spreadsheet, say A and B from 1 to 5:

Strategic, Input, Restorative, Learner, Individualization

Connectedness, Strategic, Intellection, Learner, Achiever

How can I count how many words are the same in both rows? The answer in the above case should be 2.

This array formula should work:

=SUM(IFERROR(MATCH(A:A;B:B;0)/MATCH(A:A;B:B;0);0))-1

When introducing the formula don't press enter. You have to press Control+Shift+Enter.

It should be shown like this, with curly brackets: 在此处输入图片说明

You can do something like this in column C from row 1 to 5 and sum the result of the values.

=ZÄHLENWENNS($B$1:$B$5;A1)    //German
=COUNTIF($B$1:$B$5,A1)        //English

在此处输入图片说明

You could use =SUMPRODUCT(--(COUNTIF(A1:A5,B1:B5)>0)) . Sumproduct does not require ctrl+shift+enter also not in older Excel versions.

PS This solution is not case sensitive.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM