Skip to main content
jonathanm75257324
Known Participant
Sep 24, 2018 5:36 PM UTC
Question

Error Message when calculting growth percentage

I was able to get the formula to work using the simplified notation calculator, but it was giving me the format error message.

Per my code below, I am trying to calculate ((V1+V2)/V1) -1. But it is not calculating anything. Please help!

var v1 = Number(this.getField("Original_Line_Amount)").valueAsString); 

var v2 = Number(this.getField("Overage_Amount").valueAsString); 

if (v2==0) event.value = ""; 

else event.value = (v1+v2/v1) - ; 

Thanks!

This topic is closed to new replies. Start a new post to keep the conversation going.

7 replies

try67
Community Expert
Community Expert
Sep 24, 2018 6:54 PM UTC

Change the last two lines to:

if (v1==0) event.value = ""; 

else event.value = ((v1+v2)/v1) - 1; 

Translate
Bernd Alheit
Community Expert
Community Expert
Sep 24, 2018 6:04 PM UTC

You must test v1 for zero.

Translate
Inspiring
Sep 24, 2018 6:00 PM UTC

JavaScript cannot divide by xero

Translate
Inspiring
Sep 24, 2018 6:17 PM UTC

gkaiseril  wrote

JavaScript cannot divide by xero

Sure it can, without exception.

Translate
jonathanm75257324
Known Participant
Sep 24, 2018 6:30 PM UTC

George, could you please explain with some code?

Translate