Greetings all,
I am in the process of creating a risk assessment calculator for work, and am having some issues with a particular function.
Essentially, I want the formula results to be displayed as X.XXE-X, which is easy enough to do just by cell formatting. However, when I sum multiple numbers I have values that don't "add up" due to rounding issues (e.g. 2.28E-6 + 1.06E-5 =1.28E-5 instead of rounding correctly to 1.29E-5) so I want to force the result of each formula to be rounded to three significant figures, so the sum reflects what is displayed correctly (so 2.28E-6 is actually 2.28E-6 and not 2.2758E-6 displayed as such).
After searching around for a while on this forum and elsewhere, I have determined that the way to accomplish this would be to use the following formula (let's assume that the formula is in cell A1):
=ROUND(A1,3 - 1 - INT(LOG10(ABS(A1))))
This seems to work just fine and does resolve the rounding issues. My question though (and perhaps this isn't the right place? I dunno, I am new here) is why? I understand what the component formulas are (INT, LOG10, ABS), but what does the -1- mean and how does "3 - 1 - INT(LOG10(ABS(A1))))" translate into three significant figures? I am glad that it works but I would like to be able to have a basic understanding of the syntax as I don't want to tell my superiors that I used it "because it works, but I don't know why."
Thank you very much in advance, and I apologize if I have posted this in the wrong forum!
Colin
Bookmarks