The tricky part of this formula is calculate x.

This is a variable, because it will change depending on the number being rounded.

Remember with ROUND that a negative number of digits works on theleftside of the decimal.

Excel ROUND function

The ROUND function can round to the right or left of the decimal point.

LOG10 Function

The Excel LOG10 function returns the base 10 logarithm of a number.

For example, LOG10(100) returns 2, and LOG10(1000) returns 3.

Excel LOG10 function

Note that negative numbers becomemore negative.

For example, while INT(10.8) returns 10, INT(-10.8) returns -11.

ABS Function

The Excel ABS function returns the absolute value of a number.

Excel INT function

ABS converts negative numbers to positive numbers, and positive numbers are unaffected.

Excel ABS function