Display error message if the two integer variables are not same

Dear sir,
In my attachment sheet, in row2 there is integer (how many children do you have) and in row 7 i have calculate the number and this number should be equal to row 2 if not, error msg should be display, i had tried but was not successful. Please let me know this how to do. thank you in advance .
error msg if two integer variables not equal.xlsx (45.1 KB)

Welcome to the community, @bips! You could do this by adding the following, as shown in the image below:

Reference XLSForm:

error msg if two integer variables not equal.xlsx (46.4 KB)

1 Like

Thank you very much. It works.

1 Like

Dear Kal,
If incase My variable “cnumdied” or “nummiscarriages” or “numabortion” have missing value then in those case how we should proceed further. I just only have to check if any of my variable is not missing. I hope it might have any solution. Thank you again for the prompt reply.

Replace this expression coalesce(${numpregnancies}, 0) - (coalesce((${cnumdied},0)+ coalesce(${nummiscarriages},0) + coalesce(${numabortion},0)) in H7 and that should solve your issue.

Thank for the prompt reply. Does this works, if we have have 97 ( Don’t want to answer)?

This approach only works when there is not entry in your previous variables.

Is there any solution about it?

In this case, you could use the if-statement along with the coalesce. This post discussed previously should help you solve your issue:

Thankyou very much. It really helps me.

1 Like