Skip to main content
corriep8998078
Participating Frequently
February 9, 2017
Question

subtracting cells

  • February 9, 2017
  • 1 reply
  • 565 views

I have two cells that need to be subtracted from each other.

The first cell is Receipt Total ARow1.

The second cell is the one that needs to be subtracted from the first cell, it is called LESS GST A BRow1.

The third cell is where the total of this subtraction needs to show, it is called Net Expense A BRow1.

Please tell me how to write this as a javascript and do I put it in Simplified field notation or in Custom calculation script.

Thank you

This topic has been closed for replies.

1 reply

try67
Community Expert
Community Expert
February 9, 2017

As the custom calculation script of "Net Expense A BRow1", enter this code:

event.value = Number(this.getField("Receipt Total ARow1").value) - Number(this.getField("LESS GST A BRow1").value);

corriep8998078
Participating Frequently
February 9, 2017

I've copied and pasted this into my cell, but it's still not calculating.

I've saved the javacript then gone to preview and tested it, but it does not subtract the two cells, the cell stays blank.

Have you seen this before?

try67
Community Expert
Community Expert
February 9, 2017

Don't test it in Preview Mode. Go back to the regular viewing mode of the document and then test it.

I think that scripts don't run in Preview Mode.