Copy link to clipboard
Copied
I have a sheet I have built where I am using this as a calculation for the tax to be extracted from a total amount. (Tot1 / 105 *5 *.50) This works perfectly, however, I've just been told that if the amount comes out to say $4.05 GST dividing that by the 50% comes out to 2.5 cents, which isn't ok, so it has to be we get 2 cents from the government and we eat 3 cents. Not sure if that makes sense, let me try again....
The govt pays us back the lower amount in the GST, not the upper amount so we get 2.02 back. I only need the lower amount to show on my sheet not the $2.03 amount. As that is the number we will claim back. IS there a calculation that will do that?!
Ive included an attachment that shows whats being calculated now, the GST the total gst amount is actually 50% of the GST, total GST would be .45 what I need that column to read is .22 cents, we have to lose the .23 cents because we can't calculate it in half cause there are no half cents.
Help 😞
Thank you in advance!
Copy link to clipboard
Copied
So basically you want to round the result down, to the nearest hundredth, right?
Use this code as the field's custom Calculation script:
var v = Number(this.getField("Tot1").valueAsString) / 105 *5 *.50;
var nDecimals = 2;
event.value = Math.floor(v * Math.pow(10, nDecimals)) / Math.pow(10, nDecimals);
Copy link to clipboard
Copied
Excellent, thank you!