Abstract

Significant digits of a number are the digits which contribute to its accuracy - generally these are all digits except leading and trailing zeros. For a more precise definition please see (external link!) WolframMathworld.

An Excel © worksheet function solution to calculate n significant digits of d (I found this in an Excel forum but I could not identify the original author):

A1: d
A2: n
Result: =--TEXT(A1,"."&REPT("0",A2)&"E+0")

Example: If you want to show pi with 3 significant digits:

sbNSig

A related function is sbNum2Str which returns a non-scientific string representation of a given number with all significant digits and all leading and trailing zeros.

Appendix – sbNSig Code

Please read my Disclaimer.

Option Explicit

Function sbNSig(d As Double, n As Long) As Double
'Returns double with n most significant digits of d.
'09-Nov-2019 by www.sulprobil.de PB V1.00
sbNSig = Format(d, "." & String(n, "0") & "E+0")
End Function