How to Make a Self-Marking Quiz in Excel
By ExcelReady TeamUpdated 5 min read
The short answer
To make a self-marking quiz in Excel, list the questions in one column and let people pick answers from drop-down lists. Keep the correct answers on a separate key sheet. Mark each question with =IF(C2="","",IF(C2=Key!B2,1,0)), add up the score with =COUNTIF(D2:D11,1), then hide and protect the key.
Key takeaways
- Put questions, answers, marks and the score on the quiz sheet, and the correct answers on a separate key sheet.
- Drop-down lists from Data > Data Validation stop typos that would mark a right answer wrong.
- =IF(C2="","",IF(C2=Key!B2,1,0)) marks a question and stays blank until it is answered.
- =COUNTIF(D2:D11,1) counts the correct answers; divide by the number of questions for a percentage.
- Hiding and protecting the key stops casual peeking, but it is not strong security.
On this page+
You can make a quiz in Excel that marks itself with two everyday functions: IF compares each answer with the correct one, and COUNTIF adds up the score. Drop-down lists keep answers tidy, a hidden key sheet holds the correct answers, and a few extra formulas give instant feedback. This guide builds a five-question quiz step by step, for teachers, trainers and anyone who wants to practise IF and COUNTIF on a real project.
How a self-marking quiz works#
A self-marking quiz has two sheets. The Quiz sheet holds what people see: questions, answer cells, marks and the score. The Key sheet holds the correct answers. Formulas on the Quiz sheet compare the two.
Here is the Quiz sheet:
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | No. | Question | Your answer | Mark | Feedback |
| 2 | 1 | Which function adds numbers? | |||
| 3 | 2 | What does =10/4 return? | |||
| 4 | 3 | Which symbol locks a cell reference? | |||
| 5 | 4 | Which shortcut undoes on Windows? | |||
| 6 | 5 | Which function counts cells that match one condition? |
Create a second sheet named Key, with the question numbers in A2:A6 and the correct answers in B2:B6: SUM, 2.5, $, Ctrl+Z and COUNTIF. Keep each answer in the same row as its question on the Quiz sheet, so row 2 always matches row 2.
If you need questions for an Excel skills quiz, our list of Excel quiz questions with answers is a good source.
Step 1: Add drop-down lists for the answers#
A drop-down list makes sure people pick an answer exactly as the key spells it. A typed "Sum " with a trailing space would be marked wrong, even though it is right.
- Click C2, the answer cell for question 1.
- Go to Data > Data Validation.
- Under Allow, choose List.
- In Source, type the options separated by commas:
SUM,COUNT,AVERAGE. - Click OK, then repeat for each question with its own options.
To reuse the same options, such as True and False, set up one cell and copy it down. Our guide to drop-down lists in Excel covers lists that read from a range of cells.
Step 2: Mark each question with IF#
IF checks a condition and returns one value if it's true and another if it's false. In D2, type:
=IF(C2="","",IF(C2=Key!B2,1,0))Fill it down to D6. Read it from the outside in:
C2=""checks whether the question is unanswered. If so, the mark stays blank instead of showing 0.C2=Key!B2compares the answer with the key. A correct answer scores 1, a wrong one 0.
The = comparison ignores capital letters, so "sum" matches "SUM". If case must match, use EXACT(C2,Key!B2) as the test instead. For typed answers, wrap the answer in TRIM, TRIM(C2)=Key!B2, so extra spaces don't cost a mark.
To accept more than one answer, test each with OR: =IF(OR(C5="Ctrl+Z",C5="Control+Z"),1,0). The IF function guide and our article on how the IF function works cover more patterns.
Step 3: Add feedback and the score#
Feedback tells people right away how they did on each question. In E2, type and fill down:
=IF(D2="","",IF(D2=1,"Correct","Not quite"))Then add a score panel to the right, in G1:H4:
| Label | Formula | Example result |
|---|---|---|
| Score | =COUNTIF(D2:D6,1) | 4 |
| Questions | =COUNTA(B2:B6) | 5 |
| Percent | =H1/H2 | 80% |
| Result | =IF(COUNTA(C2:C6)<H2,"Answer every question",IF(H3>=0.8,"Pass","Try again")) | Pass |
COUNTIF counts the cells in D2:D6 that equal 1, which is the number of correct answers. The Result formula waits until every question is answered, then compares the percentage with a pass mark of 80%. Change 0.8 to set your own pass mark. The COUNTIF function guide and our COUNTIF article explain the criteria.
To colour the marks, select D2:D6, choose Home > Conditional Formatting > Highlight Cells Rules > Equal To, and set 1 to green fill. Add a second rule for 0 with red fill.
Add checkbox questions#
For "select all that apply" questions, checkboxes work well. In Excel for Microsoft 365, select the cells and choose Insert > Checkbox. Each box holds TRUE when ticked and FALSE when not.
Say options for one question sit in C8:C11, and the key has TRUE or FALSE for each option in Key!B8:B11. This marks the question correct only if every box matches:
=IF(AND(C8:C11=Key!B8:B11),1,0)In older versions of Excel, use Developer > Insert > Check Box (Form Control) and link each box to a cell. Older versions may also need Ctrl+Shift+Enter for the range comparison above. Our guide to checkboxes in Excel covers both types.
Hide the answer key#
Hide and protect the key so people don't simply look up the answers:
- Right-click the Key tab and choose Hide.
- Go to Review > Protect Workbook, tick Structure, and set a password. Now the sheet can't be unhidden without it.
- On the Quiz sheet, select the answer cells C2:C6, press Ctrl+1 (Mac: ⌘1), open the Protection tab and untick Locked.
- Select the mark and feedback formulas, and on the same tab tick Hidden, so the formulas don't show in the formula bar.
- Go to Review > Protect Sheet and set a password.
People can now choose answers but can't change formulas or see the key. Excel's protection is designed to prevent accidental changes, not to stop someone determined, so don't use it for high-stakes tests. Our guide to protecting a sheet and locking cells has more detail.
Ideas to extend the quiz#
Once the basic quiz works, try these:
- A results sheet that records each person's score for a class, like a gradebook in Excel.
- Points per question, with a Points column and
=SUMIF(D2:D6,1,F2:F6)to add the points for correct answers. - A reset step: select the answer cells and press Delete. The marks, feedback and score clear themselves.
Practise it#
Try the exercise on this page to score a quiz with COUNTIF. Then practise the IF function in a live spreadsheet to write marking formulas, and practise COUNTIF to count correct answers and pass marks. Both lessons check your formula instantly. To test your own skills, take the Excel level test.
Try it yourself
This is a live spreadsheet. Type the formula in the green cell and press Enter.
Column D already marks each answer: 1 for correct, 0 for wrong, blank if unanswered. In E2, calculate the score by counting the 1s in D2:D7 with COUNTIF.
| A | B | C | D | E | F | |
|---|---|---|---|---|---|---|
| 1 | Score | |||||
| 2 | ||||||
| 3 | ||||||
| 4 | ||||||
| 5 | ||||||
| 6 | Q5 | COUNTIF | ||||
| 7 | ||||||
| 8 | ||||||
| 9 | ||||||
| 10 |
Tip: COUNTIF takes the range to check, then what to count: the number 1.
Practise this in a lesson
Frequently asked questions
Can you make a quiz in Excel?
Yes. Put the questions in a column, add drop-down lists for the answers, and use IF formulas to compare each answer with an answer key. COUNTIF then adds up the score automatically.
How do I make Excel check if an answer is correct?
Compare the answer cell with the correct answer inside IF: =IF(C2=Key!B2,"Correct","Wrong"). The = comparison ignores capital letters; use EXACT if case must match.
How do I hide the answers in an Excel quiz?
Put the answers on a separate sheet, right-click its tab and choose Hide, then use Review > Protect Workbook so the sheet can't be unhidden without a password. This deters casual users but isn't secure against a determined one.
How do I add up the score in an Excel quiz?
If each mark cell holds 1 for correct and 0 for wrong, use =COUNTIF(D2:D11,1) or =SUM(D2:D11). Divide by the number of questions, =COUNTA(B2:B11), and format it as a percentage.
Can I add checkboxes to an Excel quiz?
In Microsoft 365, select cells and choose Insert > Checkbox; each box holds TRUE or FALSE, which formulas can mark. In older versions, use a Form Control check box from the Developer tab and link it to a cell.