Glad the formula helped. As I said, having Excel determine the number of
significant figures in a number is a difficult problem:
- You will almost certainly need to implement it in VBA, with custom
functions for every supported mathematical operation (addition, subtraction,
multiplication, etc) since to Excel (and almost all other software), a number
is a number, and it carries no memory of what calculation produced it.
- You will either have to work with text representation of numbers or else
parse cell formats, since numerically there is no distinction between 34000
and 34000. to decide whether that number has 2 or 5 significant figures.
- You will need to beware of the impact of binary representations on
numbers, particularly if there are unrounded calculated values as inputs.
For example 2.3-2.2-0.1 is correctly non-zero when you consider the binary
representations of the numbers involved. For rounding purposes, I often find
it convenient to go through an intermediate string representation, such as
the VBA CDbl(CStr(x))
- If you try to avoid VBA, you will need to beware of an Excel display bug
that may cloud the issue. Millions of numbers display in Excel with 15
significant figures even though fewer were entered.
http://support.microsoft.com/kb/161234 mentions only one 3-figure decimal
fraction that is impacted over a limited range of numbers each intended to
display with 8 figures. In fact there are millions of decimal fractions
(AFAIK at least 3 decimal places and at least 8 figures total
http://groups.google.com/group/microsoft.public.excel.misc/msg/1b2d9f986ce8e65b)
so affected in Excel versions prior to 2007. If you use 2007, be sure to
include service patches through Oct 9,2007 to fix a more serious newly
introduced display issue
http://support.microsoft.com/kb/943075
Jerry