Calculation question

Dear all,

I have one question. I got some calculations, I used calculation and it works. What I want is
if I have variable A=10 & B=5 the answer will be 15.....but if A=10 & B= missing, refusal(my code is -88).... I don't want -88 to be added i.e A=10 & B=-88 I want the answer to be 10
please help me

thank you
Yo

Hello Yo,

You can use the calculation sum, for references I had attached the excel files. Please get attached to files. calculation with sum null.xlsx (10.1 KB)

Regards,
Dinesh Dongol

Hello,

You have multiple ways of achieving this depending on how missing are handled

If -88 is typed but not desired for the sum, then use:
Sum = if(${B} = -88, ${A}, ${A} + ${B})

If field B can be left blank, then use
Sum = ${A} + coalesce(${B},0)

The second parameter in coalesce() is an alternative value in case filed is blank due to skips or simply not filled

Hoping this solves your problem

JR

Dear both,

Thanks a lot!!!