J
JD
I have a spreadsheet like this:
Key | A | C | D | C | B| A | E |
Name 1 | A | C | D | B | B | A | E |
Name 2 | A | B | D | C | B | A | A |
Name 3 | B | C | A | B | B | C | A |
Going across in columns B - H (in this example) are each person's answers.
The first row is the "key" to the test, i.e. the correct answers.
I would like to calculate the number of correct answers in the last column
for each person.
I know this will work: =IF(B2=$B$1,1,0)+IF(C2=$C$1,1,0)+IF(D2=$D$1,1,)+.....
This will compare each cell (answer) to the value in row 1 (key), return 1
if equal, thereby totalling up the correct values. Works fine.
But I was looking to see if there might be an even better way to do it,
where I would not have to repeat the IF() for every column - each test may
have a varying number (sometimes large, as many as 100) of answers, so it
could get rather tedious and error prone to type in that long formula. Is
there a way I can do the above, but just specify a range instead of
repeating each comparison?
I'm sure I could do this with VBA, but I am wondering if there is a more
concise way.
Key | A | C | D | C | B| A | E |
Name 1 | A | C | D | B | B | A | E |
Name 2 | A | B | D | C | B | A | A |
Name 3 | B | C | A | B | B | C | A |
Going across in columns B - H (in this example) are each person's answers.
The first row is the "key" to the test, i.e. the correct answers.
I would like to calculate the number of correct answers in the last column
for each person.
I know this will work: =IF(B2=$B$1,1,0)+IF(C2=$C$1,1,0)+IF(D2=$D$1,1,)+.....
This will compare each cell (answer) to the value in row 1 (key), return 1
if equal, thereby totalling up the correct values. Works fine.
But I was looking to see if there might be an even better way to do it,
where I would not have to repeat the IF() for every column - each test may
have a varying number (sometimes large, as many as 100) of answers, so it
could get rather tedious and error prone to type in that long formula. Is
there a way I can do the above, but just specify a range instead of
repeating each comparison?
I'm sure I could do this with VBA, but I am wondering if there is a more
concise way.