MS Access Round() Function
The Round()
function in MS Access rounds a number to a specified number of decimal places. This is a very common mathematical function used for presenting numbers in a more concise or user-friendly format.
Round(): Definition and Usage
Round()
is used to reduce the precision of a number by rounding it to a certain number of decimal places. If the digit immediately after the rounding position is 5, and that's the end of the number, then Round()
rounds to the nearest *even* number. This is called "banker's rounding" and helps to reduce bias.
Syntax
Syntax
Round(expression, decimal_places)
Parameter Values
Parameter | Description |
---|---|
expression |
The numeric expression you want to round. This is required. |
decimal_places (Optional) |
The number of decimal places to round to. If omitted, it rounds to the nearest whole number. |
Examples
Rounding to One Decimal Place
This example rounds the 'Price' column in the 'Products' table to one decimal place. (Assume a 'Products' table exists with 'ProductName' and 'Price' columns).
Syntax
SELECT ProductName, Price, Round(Price, 1) AS RoundedPrice
FROM Products;
Output
ProductName | Price | RoundedPrice
---------------------------------
(Product names and prices) | (Rounded prices to one decimal place)
Banker's Rounding
Illustrative examples of banker's rounding:
Round(34.55, 1)
- Result: 34.6 (rounds up)Round(34.65, 1)
- Result: 34.6 (rounds down)