0

I have build a quiz and displaying score using some checks and output cells have "1" if ans correct and "0" if wrong.

to calculate score I use the function

=COUNTIF(S7:S158,1)

Problem is the score gets updated as soon user starts writing ans.

I want to have a Macro SUBMIT(using form control) which when clicked gives the score.

what should i write in Sub SUBMIT() so as to execute the above function

3 Answers 3

1

You can write fomula:

=IF(COUNTA(S7:S158)=x;COUNTIF(S7:S158,1);"")

where x is a number of questions (for example 100). So, function COUNTA counts number of non empty cells in the range, and if the user ansered on all questions, condition COUNTA(S7:S158)=x becames true and the COUNTIF(S7:S158,1) calculated, otherwise an empty string is displayed

Sign up to request clarification or add additional context in comments.

Comments

0

You can set the following code in Workbook_Open

Sheet1.EnableCalculation = False

In Sub Submit()

Sheet1.EnableCalculation = True
Sheet1.Calculate

For more, see this

Comments

0

I'm a developer and I resort to macro only when all options are exhausted. This is mainly for the benefit of people that might want use/reuse it for other purposes. But that's just my preference.

You can have a cell with a label of Show Score and accepts Yes/No and put an IF around your =COUNTIF(S7:S158,1).

1 Comment

Uhm, this is really basic Excel. Type "Show Score" into one cell. That's your label. Next to it, use data validation with the list option and enter yes and no as two values separated with a comma like "yes,no".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.