Anthony Barone
Anthony Barone

Reputation: 1

How do I compare cells in one row to cells in another row?

For example, I have the top row with the "answers" and I want to compare every row after the top row to the top row and count how many are equal:

--A B C D    
1-1 2 2 4    
2-1 1 1 1    
3-2 2 2 2    
4-1 2 1 4

I'd like a formula that would apply to rows 2:4 to compare them each to row 1 such that the result would be 1 for row 2, 2 for row 3, and 3 for row 4.

I'm not sure if it can't be done, or if I just don't know how to search for it properly, but I haven't been able to come up with anything on my own.

Upvotes: 0

Views: 114

Answers (1)

JPV
JPV

Reputation: 27242

In E2, try:

=ArrayFormula(sum(--($A2:$D2=$A$1:$D$1)))

and drag down as far as needed.

Upvotes: 1

Related Questions