count if a match occurs

  • Thread starter Thread starter niks
  • Start date Start date
N

niks

Hi!
I have two rows - say Row 1 and Row 2.
In the first row I have a answer key.
In the second row I have answers from a student.
I would like to write a formula where it counts how many answers student got write.

Here is a example:
Row 0: Q1 Q2 Q3 Q4 Q5 Q6
Row 1: 1 4 2 3 4 1
Row 2: 3 4 1 3 4 1

So student marked 4 questions correctly: Q2, Q4, Q5 and Q6.
Hence, the formula should return 4.

I know one way to do it but I am sure there is more efficient way to do it.
The way I know: Use if statement to compare two corresponding entries and output 1 if they match and 0 if not - and then sum it up.
Clearly this solution is not efficient. So how can I do it efficiently?
Thanks in advance for your help.
Niks


Submitted via EggHeadCafe - Software Developer Portal of Choice
Build an ASP.NET 2.0 Xml/Xsl Dropdown Menu UserControl
http://www.eggheadcafe.com/tutorial...026-9f3443fc87c9/build-an-aspnet-20--xml.aspx
 
Try this...

A1:F1 = answer key
A2:F2 = students answers

=SUMPRODUCT(--(A2:F2=A$1:F$1))
 
Back
Top