VBA Scoring Test Answers

Stephen_IV

Well-known Member
Joined
Mar 17, 2003
Messages
1,168
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
Can someone please help me. I am looking for some vba to automatically score some answers that I have for questions. The questions are from 1 to 5. I would like VBA to give the the TOTAL score right for each person. Can someone please help me.

Thanks in advance Stephen.
Book1
ABCDEFGHIJ
1Answer1Answer2Answer3Answer4Answer5Answer6Answer7TotalScore
2Steve24522324
3Bob34123325
4John11124353
5Mike55423132
6Ray42421532
7Tony52111224
8Sam34211552
9Tom54541233
10
11
12
13
14Score
15Answer15
16Answer24
17Answer31
18Answer42
19Answer51
20Answer63
21Answer72
Sheet1
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Actually,
The numbers that are below from B15:B21. Which are entered in by myself. It would also be OK if they had to be entered into VBA for the problem to work!
 
Upvote 0
If I read it correctly, the object is to see if cell b2 = b15, c2 = b16, etc to determine how many of the answers in row 2 match the corresponding cell in b15:b21.

I would use:
=COUNTIF($B2,$b$15)+countif($C2,$b$16)+...

but I'm sure you can come up with a shorter formula than me Paddy/Zack!
 
Upvote 0
OK

In this example there are 7 questions per each person. Each person took a test seperatly. What I have done is enter the answers into excel. The right answers per each question are located in B15:B21. So qeustion 1 the right answer would be 5, question 2 would be 4, question 3 would be 1 and so forth. Steve answered question 1 with an answer of 2 which would not be right because the answer to question 1 was 5. So what I would lik is a tally of the how many correct answers each person had. I would preferably like this done in VBA if possible. I hope that I am making myself clear. Sorry if I am not.
Steve
 
Upvote 0
see the example:
Book1
ABCDEFGHI
1NameAnswer1Answer2Answer3Answer4Answer5Answer6Answer7TotalScore
2Steve24522324
3Bob34123325
4John11124353
5Mike55423132
6Ray42421532
7Tony52111224
8Sam34211552
9Tom54541233
10
11Answers
12Answer15
13Answer24
14Answer31
15Answer42
16Answer51
17Answer63
18Answer72
Sheet3



the formula in i2 is:

=SUMPRODUCT(($B$1:$H$1=$A$12:$A$18)*(B2:H2=$B$12:$B$18))

...which is then copied down. note the mix of absolute / relative references.
 
Upvote 0
Thanks Paddy. I appreciate your time and help on this situation. Thanks Again!
 
Upvote 0
Althought Paddy D did give me a formula answer I am still looking for a VBA approach can anyone please still help me?
 
Upvote 0

Forum statistics

Threads
1,215,425
Messages
6,124,824
Members
449,190
Latest member
rscraig11

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