Got a version of Excel that uses the menu interface (Excel 97, Excel 2000, Excel 2002, or Excel 2003)? This site is for you! If you use a later version of Excel, visit our ExcelTips site focusing on the ribbon interface.
With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company.
Learn more about Allen...
Please Note: This article is written for users of the following Microsoft Excel versions: 97, 2000, and 2003. If you are using a later version (Excel 2007 or later), this tip may not work for you. For a version of this tip written specifically for later versions of Excel, click here: Rounding to Two Significant Digits.
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:
ExcelTips is your source for cost-effective Microsoft Excel training. This tip (10396) applies to Microsoft Excel 97, 2000, and 2003. You can find a version of this tip for the ribbon interface of Excel (Excel 2007 and later) 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!