Overview
The TRUNC(NUMBER) function in Saved Search Formula is used to truncate a number to a specified number of decimal places, effectively removing the fractional part without rounding. In simpler terms, it allows you to shorten a number by cutting off digits after a certain decimal point, which is particularly useful in NetSuite's Saved Searches when you need precise numerical data without rounding adjustments.
Understanding the Syntax
The TRUNC(NUMBER) function is structured as follows:
TRUNC(number, [num_digits])
- number: The numeric value you want to truncate.
- num_digits (optional): An integer specifying the number of decimal places to retain. If omitted, it defaults to 0, meaning the number is truncated to an integer.
Common Usage Scenarios
Scenario | Formula | Sample Result |
|---|
Truncate to an integer | TRUNC(123.456)
| 123 |
Truncate to two decimal places | TRUNC(123.456, 2)
| 123.45 |
Truncate to zero decimal places | TRUNC(123.456, 0)
| 123 |
Truncate to the tens place | TRUNC(123.456, -1)
| 120 |
Truncate to the hundreds place | TRUNC(123.456, -2)
| 100 |
By utilizing the TRUNC(NUMBER) function, you can effectively manage numerical data in NetSuite, ensuring precision and consistency in your reports and analyses. This function is particularly useful when you need to remove the fractional part of numbers without rounding, allowing for accurate data representation.
-----
If you find this information useful, let us know by reacting or commenting on this post!