Excel-Like Rounding of Numbers in Microsoft® Access
“I am used to using the ROUND function in Excel to control the number of decimal places in the results of a formula, but I cannot find one in Access. Is there one?”
Last updated on 2022-10-26 by David Wallis.
This topic is relevant to Microsoft Access 97, 2000, 2002 (XP), 2003, 2007, 2010, 2013, 2016, 2019 and Microsoft 365.
There are a number of functions in Access that perform rounding, but none of these works in the same way as Excel’s ROUND function.
For a full description of these functions, see Rounding Numbers in Microsoft Excel, Access and VBA.
Excel’s ROUND function performs arithmetic rounding; Access’s ROUND function performs bankers rounding.
This is an Excel-like rounding function for use in Microsoft Access:
Function fnDmwSymArithRound(Number&, DecPlaces%) As Double
dbl# = CDec(Nz(Number&))
dbl# = CDec(dbl# * 10 ^ DecPlaces%)
fnDmwSymArithRound = _
Fix(dbl# + 0.5 * Sgn(Number&)) / 10 ^ DecPlaces%
Please use the function on the understanding that you let us know of any circumstances under which it does not perform as intended.
Rounding Numbers in Microsoft Excel, Access and VBA is an article on the whole subject of rounding.
A description of the CDec() function appears in Floating Point Numbers and Scaling.
Your Support for DMW TIPS
Please support this website by making a donation to help keep it free of advertising and to help towards cost of time spent adding new content.
To make a contribution by PayPal in GBP (£ sterling) —
To make a contribution by PayPal in USD ($ US) —
Thanks, in anticipation.
DMW Consultancy Ltd does not accept any liability for loss or damage to data to which any techniques, methods or code included in this website are applied. Back up your data; test thoroughly before using on live data.