How to use the TRUNC function
What is the TRUNC function?
The TRUNC function removes the fractional part of the number to an integer. Trunc stands for truncate meaning in this context removing the decimal part leaving only the integer.
What is the fractional part of a number?
The fractional part of a number is the portion after the decimal point. It represents the fractional remainder when dividing a number into integer parts.
For a number x, the fractional part is denoted as:Â {x} The fractional part is equal to x minus the integer part of x.
For example, Â x = 5.921 The integer part of x is 5 (rounded down)
The fractional part is: {x} = x - integer part of x
5.921- 5 equals 0.921
What is a fractional remainder?
The fractional remainder or fractional part refers to the non-integer portion left over after dividing a number by an integer.
For example, if we divide 5 by 2: 5 / 2 = 2 with fractional remainder 1 2*2 + 1 = 5
The integer quotient is 2, but there is a remaining fractional amount of 1 left.
What is an integer?
An integer is a whole number that can be positive, negative, or zero.
What is the difference between the TRUNC function and the ROUND function?
The ROUND function rounds a number to a specified number of digits while the TRUNC function removes digits based on the precision of the truncation that you specify.
For example, TRUNC(11.9345,0) returns 11 and ROUND(11.9345,0) returns 12
How to round numbers?
Rounding is a method to simplify a number by reducing its digits while keeping its approximate value close to the original value.
There are a few common ways to round:
- Round to a set number of decimal places, rounding 2.13579 to 2 decimal places gives 2.14.
- Round up or down to the nearest integer, rounding up 2.3 gives 3. Rounding down 2.3 gives 2.
- Round to a set increment, rounding to the nearest 10 rounds 17 to 20.
- Round to significant figures, rounding 2.333 to 3 significant figures gives 2.33.
When rounding, look at the first digit after where you want to round. If it's 5 or more, round up. If less than 5, round down. Rounding makes numbers cleaner and easier to work with in many everyday situations, however, they may also cause rounding errors like rounded values can compound errors. Rounding measurements and constants may reduces precision. It is better to round numbers after performing calculations than before.
What is the difference between TRUNC function and the TRIM function?
TRUNC truncates numbers to a specified number of decimal places. For example:
TRUNC(193.459, 2) = 193.45
TRIM removes leading, trailing, and excess whitespace from text. For example:
TRIM(" Orange ") = "Orange"
What is the difference between the TRUNC function and the INT function?
The INT function extracts the integer part of a number while the TRUNC function lets you specify the precision of the truncation.
For example, TRUNC(11.2345,1) returns 11.2 and INT(11.2345) returns 11
TRUNC Function Syntax
TRUNC(number, [num_digits])
TRUNC Function Arguments
number | Required. The number you want to truncate. |
[num_digits] | Optional. A number specifying the precision of the truncation. If omitted 0 (zero) is used. |
TRUNC function example
Formula in cell C3:
Functions in 'Math and trigonometry' category
The TRUNC function function is one of 73 functions in the 'Math and trigonometry' category.
How to comment
How to add a formula to your comment
<code>Insert your formula here.</code>
Convert less than and larger than signs
Use html character entities instead of less than and larger than signs.
< becomes < and > becomes >
How to add VBA code to your comment
[vb 1="vbnet" language=","]
Put your VBA code here.
[/vb]
How to add a picture to your comment:
Upload picture to postimage.org or imgur
Paste image link to your comment.
Contact Oscar
You can contact me through this contact form