Thursday, May 3, 2018

Formula Excel : Rounding to Significant Digits

In some financial reports, figures are presented in significant digits. The idea is that when you’re dealing with numbers in the millions, you don’t need to inundate a report with superfluous numbers for the sake of showing precision down to the tens, hundreds, and thousands places.

For instance, instead of showing the number 883,788, you could choose to round the number to one significant digit. This would mean displaying the same number as 900,000. Rounding 883,788 to two significant digits would show the number as 880,000.

In essence, you’re deeming that a particular number’s place is significant enough to show. The rest of the number can be replaced with zeros. You might feel as though doing this could introduce problems, but when you’re dealing with large enough numbers, any number below a certain significance is inconsequential.

Image 2-12 demonstrates how you can implement a formula that rounds numbers to a
given number of significant digits.

Image 2-12: Rounding numbers to 1 significant digit.

How it works

You use Excel’s ROUND function to round a given number to a specified number of digits. The ROUND function takes two arguments: the original value and the number of digits to round to.

Entering a negative number as the second argument tells Excel to round based on significant digits to the left of the decimal point. The following formula, for example, returns 9500:

=ROUND(9489,-2)

Changing the significant digits argument to -3 returns a value of 9000.

=ROUND(B14,-3)

This works great, but what if you have numbers on differing scales? That is, what if some of your numbers are millions while others are hundreds of thousands? If you wanted to show them all with 1 significant digit, you would need to build a different ROUND function for each number to account for the differing significant digits argument that you would need for each type of number.

To help solve this issue, you can replace your hard-coded significant digits argument with a formula that calculates what that number should be. Imagine that your number is -2330.45. You can use this formula as the significant digits argument in your ROUND function:

LEN(INT(ABS(-2330.45)))*-1+2

This formula first wraps your number in the ABS function, effectively removing any negative symbol that may exist. It then wraps that result in the INT function, stripping out any decimals that may exist. It then wraps that result in the LEN function to get a measure of how many characters are in the number without any decimals or negation symbols.

In this example, this part of the formula results in the number 4. If you take the number -2330.45 and strip away the decimals and negative symbol, you have four characters left.

This number is then multiplied by -1 to make it a negative number, and then added to the number of significant digits you are looking for. In this example, that calculation looks like this: 4*-1+2 = -2.
Again, this formula will be used as the second argument for your ROUND function. Enter this formula into Excel and round the number to 2300 (2 significant digits):

=ROUND(-2330.45, LEN(INT(ABS(-2330.45)))*-1+2)

You can then replace this formula with cell references that point to the source number and cell that holds the number of desired significant digits. This what you see in Figure 2-12, shown previously.

=ROUND(B5,LEN(INT(ABS(B5)))*-1+$E$3)


0 komentar:

Post a Comment