Formula to calculate only if a cell has value, else to be blank

I am trying to create a quiz, and in the sheet, I have three columns, one for Answer, one for Correct Answer, and one for Result.
Initially, the Answer column will be blank, as user has not selected an answer, the Correct answer will have the correct answer value, and the Result column will show True if Answer = Correct Answer and false if Answer not equal to Correct Answer. But, when the answer Column is blank, I want the Result to be blank, Right now, with the formula I have used =ARRAYFORMULA(IF(LEN(A2:A)=0,“”,G2:G=H2:H), it is showing FALSE. Could you help me with the correct formula I can use to keep Result blank if the Answer is blank?

Use a template column in Glide data editor to set the response (or use a gsheet column, no matter).

Then add an if/then/else column in data editor with the following : if response is empty then empty else “answer column”.

And in your app, the answer will be displayed using the if/then/else column.

I am sorry I am not able to understand your approach. If I use the IF-THEN-ELSE column in data editor, is this what I use?
If Answer is empty, then Result is Empty
Else Result = Answer?

Is that what you are suggesting?

The if/then/else column will be populated as follow : if answer is empty then “empty” (null value) else “value of the result column” (true or false)

And your result column will also be an if/then/else column : if answer is empty then empty And if answer equals correct answer then TRUE else FALSE

How do i check if Answer equals Correct Answer using the If-Then-Else column. Because, I dont see an option to compare two columns, it only compares a column with a value we need to enter.
image

Try this formula instead
=arrayformula(IF(LEN(G2:G)=0,"",if(G2:G=H2:H,TRUE,FALSE)))

1 Like

That worked! Thank you very much! :heart_eyes:

1 Like

Try this nested formula in Sheets:

IF(IF(len(A2:A)=0,"",G2:G=H2:H)=FALSE,"",IF(len(A2:A)=0,"",G2:G=H2:H))

Thanks for helping. I already got the answer.as mentioned above.