說明
Use this function to round a number to a specified number of digits. Supported in Chains.
Round is useful for controlling the precision of numerical data in calculations and display.
語法
ROUND(number, num_digits)
Inputs
This function accepts the following arguments:
名稱 | 必要 | 說明 | Valid input |
---|---|---|---|
數字 |
是 | The number you want to round. | A real number, a cell reference that contains a real number, or a formula which results in a real number. |
num_digits |
是 | The number of digits to which you want to round the number. | An integer, a cell reference that contains an integer, or a formula which results in an integer. |
範例
範例資料
A | B |
---|---|
3.14159 | 1234.5678 |
-2.9876 | 0.0005 |
10.5 | 99.99 |
Fred | 3/11/2022 |
Sample formulas
公式 | 說明 | 結果 |
---|---|---|
=ROUND(A1, 2) |
Rounds 3.14159 to 2 decimal places. | 3.14 |
=ROUND(B1, -2) |
Rounds 1234.5678 to the nearest hundred. | 1200 |
=ROUND(A2, 1) |
Rounds -2.9876 to 1 decimal place. | -3.0 |
=ROUND(B2, 3) |
Rounds 0.0005 to 3 decimal places. | 0.001 |
=ROUND(A3, 0) |
Rounds 10.5 to the nearest whole number. | 11 |
=ROUND(A4, 0) |
Rounds cell A4 to the nearest whole number. This fails because it is text. | #VALUE! |
附註
- If ROUND is applied to text, it will result in a #VALUE! error.
- ROUND is different from formatting a cell to display a certain number of decimal places, as it actually changes the value stored in the cell by removing all digits to the right of the last digit rounded.
- ROUND follows standard rounding rules: if the digit to the right of the rounding position is 5 or greater, it rounds up; otherwise, it rounds down.
- Applying ROUND to a positive number will increase it in a positive direction, applying ROUND to a negative number will increase it in a negative direction.
- ROUND differs from ROUNDUP and ROUNDDOWN in the following ways:
- If
num_digits
is positive (greater than 0), ROUND rounds (up or down) to the specified number of decimal places. - If
num_digits
is 0, ROUND rounds (up or down) to the nearest integer. - If
num_digits
is negative (less than 0), ROUNDUP rounds (up or down) the digits to the left of the decimal point. - ROUNDUP always rounds away from zero.
- ROUNDDOWN always rounds towards zero.
- If
提示
- Use ROUND when you need to perform calculations with a specific level of precision.
- For displaying numbers with a certain number of decimal places without changing the underlying value, use cell formatting instead of ROUND.
- ROUND can be combined with other functions such as SUM or AVERAGE for more complex calculations.
- Be aware of potential rounding errors in financial calculations where high precision is required.
- Consider using ROUNDUP or ROUNDDOWN if you need to always round in a specific direction regardless of the digit values.
- Consider using the other rounding functions (linked in Related functions) if you need to round numbers in a different manner.