# Fixing infinity value returned (using if-statement)

Hi all,

Here again seeking assistance on how to address an infinity value. How do you get zero instead of infinity to be returned.

Eg. 0 * 7 = 0 instead of infinity or 0 divided by 6 = 0. I need the zero to be the defined value

Hi,
You can do this by using if for the calculation. An example would be if you had two questions e.g. Q1 and Q2 where you calculation is always Q3= Q1 divide by Q2, you can always set the if before the calculation as follows:

if(Q1=0,0,(if(Q2=0,0,Q1 div Q2)))

REMEMBER TO REFERENCE THE Q1 and Q2 in accordance with your form and as dictated in conducting calculations.

Stephane

1 Like

Thank you for replying. If I understand correctly this is the calculation I ultimately want to compute:

dependency ratio = number not working (Q1) div number working (Q2)

dependency ratio = if(Q1=0,0,(if(Q2=0,0,Q1 div Q2)))**

is this correct?

Hi,
Yes that should do but remember to put Q1 and Q2 as appropriate i.e. \${Q1) AND \${Q2)

Stephane

1 Like

I follow. will let you know how it works out

2 Likes