Calc: impose a maximum number of digits (regardless of decimal point placement) in numbers in cells?

I have a spreadsheet with the number of units of different investment funds, and the price per unit of each (in the same row).

Some of these “price per unit” values can have more than 10 decimal places, e.g. 5.6343268597991. Some of the numbers of units can be in the thousands, but also with decimals, e.g. 14858.28.

What I want to do is somehow find a way of rounding all these cells to a specific number of numbers, regardless of where the decimal point happens to be. So if I limited to 6 digits, rounded, the above 2 numbers would become:

5.63433
14858.3
(i.e. both rounded up…)

Any way of doing this? With or without a macro?

Decimal logarithm can give you the number of digits left of decimal point. Use this information for rounding the value.

1 Like

ROUNDSIG function rounds to N significant decimal digits.

6 Likes