Tammy needs to round values in a worksheet to two significant digits. For instance, if a cell contains 137, it should round to 140; if it contains 0.0005937 it should round to 0.00059; and if it contains 156735.32 it should round to 160000. She wonders if there is a simple formula to round any given number to only two significant digits.
Of course, it depends on what your definition of "simple" is. Fact of the matter, though, is that there are several different formulas you can use to get the desired result. Assuming that your original value is in cell A1, you can use any of the following representative formulas:
=ROUND(A1/(10^(INT(LOG10(ABS(A1)))+1)),2)*(10^(INT(LOG10(ABS(A1)))+1)) =ROUND(A1,-(INT(LOG(ABS(A1),10))+1)+2) =FIXED(A1,1-INT(LOG10(ABS(A1)))) =ROUND(A1,1-INT(LOG(ABS(A1))))
These formulas will work with either positive or negative values just fine. The LOG (or LOG10) function is used to determine the number of digits either to the left or right of the decimal place before the first significant digit occurs. The INT of that function actually provides a number that is one less than the number of digits required, so that is why the value has 1 added to it. We can then round using that number of digits.
If you think that you may want to use a different number of significant digits than two, then you can use either of the following formulas:
=ROUND(A1,2-INT(LOG(ABS(A1)))-1) =ROUND(A1,2-INT(LOG10(ABS(A1)))-1) =FIXED(A1,2-INT(LOG10(ABS(A1)))-1)
All you need to do is change the 2 to reflect any number of significant digits you want. More information about significant digits in Excel can be found here:
https://excelribbon.tips.net/T012083
ExcelTips is your source for cost-effective Microsoft Excel training. This tip (10397) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, and Excel in Office 365. You can find a version of this tip for the older menu interface of Excel here: Rounding to Two Significant Digits.
Save Time and Supercharge Excel! Automate virtually any routine task and save yourself hours, days, maybe even weeks. Then, learn how to make Excel do things you thought were simply impossible! Mastering advanced Excel macros has never been easier. Check out Excel 2010 VBA and Macros today!
If you want to round a value to some multiple of a whole number, you'll want to become familiar with the MROUND function. ...
Discover MoreWhen working with financial data, it's easy to round values to the nearest dollar. What if you want them rounded to the ...
Discover MoreRounding is a fact of life when it comes to using formulas in a worksheet. Sometimes that rounding can be a bit ...
Discover MoreFREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
2020-11-15 06:32:00
Peter Atherton
=ROUND(A1,1-INT(LOG(ABS(A1)))) is the shortest formula, so that is the one I'd use.
The FIXED formula returns a text value so add a zero @ the end. =FIXED(A8,1-INT(LOG10(ABS(A8))))+0
Tony,
Copy and paste the formula into B1, and then paste B1 into whatever cell you want.
2020-11-15 06:09:53
Tony Degnen
Please disregard my previous comment, the formulae work perfectly in Excel. I didn't realise I was using an alternative spreadsheet program. Doh!
2020-11-14 20:02:51
Tony Degnen
Your tip on rounding to two significant digits produced only "err:508" when I tried it. This happened with all the alterrnative formulae you provided (e.g. =ROUND(A1/(10^(INT(LOG10(ABS(A1)))+1)),2)*(10^(INT(LOG10(ABS(A1)))+1)).
Am I doing something wrong?
2020-11-14 10:25:26
J. Woolley
Another way for N significant digits is to format as Scientific with (N-1) decimal places.
Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.
FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
Copyright © 2021 Sharon Parq Associates, Inc.
Comments