I need to show two significant digits, but it is important that the original data does not get lost.
Currently I have a macro that uses ROUND, however this changes the actual number instead of changing only the decimal places.
cell.Value = Round(cell, 1 - (1 + Int(Log(Abs(cell)) / Log(10))))
For other numbers I have
cell.NumberFormat = "#"
Then Excel shows only how many numbers I tell it to but I cannot get a variable number of digits, right?
Is there a way to combine these to so that excel will show two significant numbers?
What you can do is you can calculate how many digits you want to show as you did:
And then set the number format accordingly
So if
Digitsis1it will use0.0as number format and if it is2it will use0.00as number format.So for example the following numbers will show as below