
1. Re: 'Truncate' Excel Formula in JavaScript
MichaelN Sep 24, 2014 8:10 PM (in response to JulesNotSoPro)Use the Math.floor() method to round a number down to the nearest integer.
Have a look here:

2. Re: 'Truncate' Excel Formula in JavaScript
JulesNotSoPro Sep 24, 2014 8:29 PM (in response to MichaelN)thanks but where do I use it? in my actual field calculation script
If I write Math.floor((RAD*(MPIR/100))/365) either in the simplified field notation or the custom calculation script it does not seem to work....

3. Re: 'Truncate' Excel Formula in JavaScript
George_Johnson Sep 25, 2014 12:11 AM (in response to JulesNotSoPro)The Math.floor method is not equivalent to the TRUNC function. It is for positive values, but for negative values you should use Math.ceil. Here's what the script might look like:
// Custom calculation script
(function () {
// Get the field values as numbers
var RAD = +getField("RAD").value;
var MPIR = +getField("MPIR").value;
// Perform the calculation
var result = RAD * MPIR / 100 / 365;
// Truncate the result to two decimal places
if (result >= 0) {
event.value = Math.floor(result * 100) / 100;
} else {
event.value = Math.ceil(result * 100) / 100;
}
})();

4. Re: 'Truncate' Excel Formula in JavaScript
JulesNotSoPro Sep 29, 2014 7:37 PM (in response to George_Johnson)thank you!!