Please Note: This article is written for users of the following Microsoft Excel versions: 97, 2000, 2002, and 2003. If you are using a later version (Excel 2007 or later), this tip may not work for you. For a version of this tip written specifically for later versions of Excel, click here: Custom Formats for Scientific Notation.

Custom Formats for Scientific Notation

by Allen Wyatt
(last updated July 3, 2019)

10

Reid notes that he can display numbers using scientific notation and they appear in Excel in the format 1.23E+03 or 1.23E-03. He would like the scientific notation to be shown differently, such as 1.23x10^3 or 1.23x10^-3.

There is no way in Excel to change the way in which scientific notation is displayed. The only workaround is to use a formula to put together a text representation of what you want. For instance, if a value that uses Excel's scientific notation is stored in cell C7, you could use the following formula:

=LEFT(TEXT(D7,"0.00E+0"),3) & "x10^" & RIGHT(TEXT(D7,"0.00E+0"),3)

This formula essentially pulls the left portion of the number (the part before the E) and combines it with the right part of the number (the part after the E) together with the "x10^" notation. The result is considered a text string by Excel; it cannot be used in subsequent calculations.

If you needed to do quite a bit of formatting in this manner, it would be a relatively trivial matter to create a macro that returned the formatted text string based on the number. Create it as a user-defined function and you could then use it in your formulas.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (9234) applies to Microsoft Excel 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Excel (Excel 2007 and later) here: Custom Formats for Scientific Notation.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Pin Items to the Start Screen

You can improve your efficiency at launching applications by using the Start Screen. This tip shows you how to pin items ...

Discover More

Controlling Where a Full-page Border is Printed

When you add full-page borders to your document, you may be bothered to find out that one or more sides of the border ...

Discover More

Date for Next Wednesday

When working with dates, it is often helpful to be able to calculate some date in the future based on a starting date. ...

Discover More

Excel Smarts for Beginners! Featuring the friendly and trusted For Dummies style, this popular guide shows beginners how to get up and running with Excel while also helping more experienced users get comfortable with the newest features. Check out Excel 2013 For Dummies today!

More ExcelTips (menu)

Handling Negative Numbers in a Complex Custom Format

Custom formats are great for defining how a specific value in a cell should look. They aren't that great at doing complex ...

Discover More

Using Strikethrough Formatting

Need a line through the middle of your text? Use strikethrough formatting, which is easy to apply using the Format Cells ...

Discover More

Stopping Fractions from Reducing

Enter a fraction into Excel, and you may be surprised that the program reduces the faction to its simplest form. If you ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is six more than 2?

2020-02-26 06:29:15

Peter

You could create a custom format. For example put the number 3333 in a cell then replace the number format with something like "3.333E3" in a macro. (This format is not available in Excel) You would have to update the format every time the cell is updated. Also if you want to display zero, you would need to use the extra element(s) of the custom format.
This method preserves the content of the cell as a number.


2020-02-24 11:54:19

Phillip

Yes Pieter, I also had the strange order on mine as I developed it as well. I found on my computers I had to place the negative sign in the exponent after the numeral to get it to display normally. In the code I have it as "ChrW(185) & ChrW(1470)" for example. Not sure why that is. Perhaps you would be able to place them in normal order. And I liked using the × sign rather than the dot, but that's personal preference.

I'm sure one could combine the characters for exponents greater than 9, but for me, I think I will hardly ever use them.

Thanks for your hint on the correct ChrW codes to use.


2020-02-22 18:07:59

Pieter de la Court

Interesting solution from Phillip, nice with the optional parameter and the Choose() function. Only I get some strange results with negative exponents showing for example as: 0.02322×-10² instead of 2.322·10⁻² and exponents larger than 9 do not show up at all. Is that only for me, or do others have the same problems?
Anyway, I decided to present my old userfunction in full. This has worked for me for all practical purposes. I just improved it a bit with Phillip's idea of optional parameters and Choose(). Suggestions for further improvements are very welcome.

Function SciNot(Val As Variant, Optional MinPosExp As Integer = 0, Optional MaxNegExp As Integer = 0) As String
' This function converts a number to a string that contains
' the number in scientific notation: xxx·10'''
' where ''' stands for the exponent, written as a superscript
' As it is impossible to set the characters to superscript in the function,
' unicode characters are used that are already in superscript format
' The optional parameters set the range of values that will not be converted to scientific notation
' MinPosExp must normally be a positive, and MaxNegExp a negative integer
' The default range excludes only the numbers that would result in an exponent of 0
' If you want any number to be in scientific notation (except 0), set MinPosExp to -1 or MaxNegExp to 1
' If the output string contains more decimals than desired, you can use the Round() function to reduce the
' resolution of the input value
' LIMITATION: The mantissa of the number is rounded to maximum 13 decimals
' This is to prevent effects of rounding errors
'
' This code is available for free use at your own risk. It is offered
' as is and no liability will be accepted by the programmer for
' any consequences of the use of this code'
'
' Programmed by Pieter de la Court, 2018

Dim i As Integer
Dim sExpon As String 'exponent as a string
Dim e As String 'exponent in Unicode (superscript) characters
Dim lPwr As Long 'Rounded power of ten of the number (used to determine the exponent)
Dim Sign As String 'Sign of the number
Dim dVal As Double 'Value of the number as a Double type
Dim Mant As String 'Mantissa for the number in scientific notation

Application.Volatile

If Len(Val) = 0 Then
SciNot = ""
Exit Function
End If

If Val = 0 Then
SciNot = "0"
Exit Function
End If

dVal = CDbl(Val)
Sign = ""
If dVal < 0 Then
Sign = "-"
dVal = -Val
End If

lPwr = Round(Log(dVal) / Log(10#) - 0.499999999999999, 0)

If lPwr >= MaxNegExp And lPwr <= MinPosExp Then
SciNot = CStr(Val)
Exit Function
End If

'Now create the exponent string
sExpon = CStr(lPwr)
e = ""

For i = 1 To Len(sExpon)
If Mid(sExpon, i, 1) = "-" Then
e = e & ChrW(8315)
Else

e = e & Choose(CInt(Mid(sExpon, i, 1)) + 1, ChrW(8304), ChrW(185), ChrW(178), _
ChrW(179), ChrW(8308), ChrW(8309), ChrW(8310), ChrW(8311), ChrW(8312), ChrW(8313))
End If
Next i

Mant = CStr(Round(Val / 10 ^ lPwr, 13))
SciNot = Mant & ChrW(183) & "10" & e
End Function


2020-02-21 16:42:54

Phillip

Whoops, I didn't notice the other comments below. I combined what I learned from Pieter de la Court's code for the exponent to

Public Function SciNot(cell As Range, Optional places As Integer = 3) As String
'Displays numbers as text resembling scientific notation

Dim num As String
Dim choice As Double
Dim Power As Integer
Application.Volatile

' Check if number is positive or negative
Debug.Print "Sgn(Cell) = " & Sgn(cell.Value)
If (Sgn(cell.Value) < 1) Then
num = "-"
Else
num = ""
End If

Select Case Abs(cell.Value)
Case Is < 1
num = num & Round(10 ^ (Application.WorksheetFunction.Log10(Abs(cell.Value)) + Fix(Abs(Application.WorksheetFunction.Log10(Abs(cell.Value)) - 1))), places) & "×10"

choice = Abs(Fix(Application.WorksheetFunction.Log10(Abs(cell.Value)) - 1))
num = num & Choose(choice, ChrW(185) & ChrW(1470), ChrW(178) & ChrW(1470), ChrW(179) & ChrW(1470), ChrW(8308) & ChrW(1470))
SciNot = num ' ? ¹ ² ³ ? ? ? "^7", "^8",

Case Is >= 1
num = num & Round(10 ^ (Application.WorksheetFunction.Log10(Abs(cell.Value)) - Int(Abs(Application.WorksheetFunction.Log10(Abs(cell.Value))))), places) & " ×10"
choice = Abs(Fix(Application.WorksheetFunction.Log10(Abs(cell.Value)))) + 1
num = num & Choose(choice, ChrW(8304), ChrW(185), ChrW(178), ChrW(179), ChrW(8308), ChrW(8309), ChrW(8310), ChrW(8311), ChrW(8312), ChrW(8313))
SciNot = num
End Select

Debug.Print "SciNot = " & SciNot

End Function

The strange thing is that the negative sign in the exponent has to be placed after the actual exponent for it to display properly. I don't know why that is, but I can work with it.


2020-02-21 16:02:19

Phillip

This is similar to what I'm trying to do. I want the number expressed in true scientific notation, and it doesn't matter if it isn't actually a number. I have created a function that checks for negative numbers in the mantissa and exponent. It's formatting is good except for the exponent. I would really like to use numbers like ⁰ ¹ ² ³ ⁴ ⁵ ⁶ ⁷ ⁸ ⁹, but 4 and above do not seem to display. Alternatively, it would be nice to format the last digit in the string as a superscript. I guess it is possible to do that outside the function, but I'm greedy and would like it all in one step.


2019-04-10 13:25:48

Roy

If you apply the following format:

.#####,"*10^3" (there's a period at the start)

then 132.52 displays as: .13252*10^3 and 31245132.58 displays as: 31245.13258*10^3

A leading "0" will change decimals from " .xyz " to " 0.xyz ".

Quite a few other variations are available. Adding extra commas before the text portion ups the ante on power of ten being displayed, just like when displaying money amounts as thousands or millions.

The " &10^3 " is just text though, not dynamic to follow the power of ten, and it shows even when one has a blank or 0 in the cell, however, adding " ;; " after the above format, or " ;;0 " has the desirable effect of removing it and not displaying anything, or displaying a bare "0".

While it will work for what you can plan for, and for about four of those, maximum, it is NOT dynamic and will not handle a wide range of powers of ten, just what you can fit in the four customizing places.

However, it WILL round using the 4/5 convention in what it displays (but leave the number itself untouched, as one would expect).

Speaking of "as one would expect"... using any format in TEXT() converts it to what would be displayed if used as a custom format. So any rounding happens for real when filtered through TEXT(). But as an actual custom format for a cell, the rounding is display only.

One can suppress the displayed result after a point (rounding effect still occurs, but rounding at the displayed "edge"). Using:

#,###,"*10^3" (NO period at the start)

will display " 31245132.58" as: " 31,245*10^3 "

and it can march off the powers of ten in sets of three places as far out as one likes.

Take the double quotes off the " *10^3 " and you get vaying odd effects. One result I get for the last number used is: 312451311111 3^3. Along with some other variations, it seems it is splitting the non-decimal portion of the number based upon the "10" in " *10^3 " into a left and right portion but not, say, the left 4 digits on the left, the right 2 digits on the right, but overlapping: the fourth digit appearing in both sides, say, and... make it " *100^3 " and you begin to see what I mean. Oh, and the " ^3 " remains as text added on, even though it is not in double quotes. Playing with the " * " in that text addon, making it an "x" for example, makes me think there's a repeating effect occurring as the digits repeated rather than just overlapped make the display fill the cell while using "x" just creates the odd overlap. Geez, just did five different things including making the 1 in 100 march left to the beginning of the display. Seems one can make any numeric character SET march left through the number. "22" for instance. Spaces as well, but apparently not alpha characters. But... extended characters... ¢ for example... work too.

Well, lots to explore here, eh. But it DOES do what Reid asked for, except for not being dynamic, and therefore limited to controlled and known value ranges.


2017-10-02 12:59:31

PawelG.

=SUBSTITUTE(TEXT(A1,"0.0000000E+0"),"E","*10^") works better.

Chang e"0.0000000E+0" to whatever precision you need.


2017-05-09 10:17:34

govalley

it's great. thank you so much


2016-04-01 12:48:35

David Hagar

Here it is!!!!
All you have to do is place a # at the beginning of the regular scientific notation to format in engineering notation!!!

format: 0.000E+00 #00.000 E+00
------------------------------------
number: 3.142E+14 314.159E+12
3.142E+12 03.142E+12
3.142E+11 314.159E+09
3.142E+10 31.416E+09
3.142E+09 03.142E+09


2014-11-15 10:13:49

Pieter de la Court

Finally: a function for proper scientific notation!
For a very long time I have been looking for a function that converts a number to text in the real scientific format, not the clumsy notation with E+23 or 10^-5.
Finally I think I found a solution.
Rather than formatting part of the string into superscript, the function uses Unicode characters for superscript "0" to "9" and superscript "-".
The basic VBA function for the exponent part is given below. This can easily be extended to a function doing the whole number with automatic mantissa and exponent calculation.

Function SciExp(Expon As Integer) As String

Dim sExpon As String
Dim i As Integer
Dim e As String
Dim Dig As String
Dim U As Long

sExpon = CStr(Expon)
e = ""

If Expon = 0 Then
SciExp = ""
Exit Function
End If

For i = 1 To Len(sExpon)
Dig = CStr(Mid(sExpon, i, 1))

Select Case Dig
Case "0"
U = 8304
Case "1"
U = 185
Case "2"
U = 178
Case "3"
U = 179
Case "4"
U = 8308
Case "5"
U = 8309
Case "6"
U = 8310
Case "7"
U = 8311
Case "8"
U = 8312
Case "9"
U = 8313
Case "-"
U = 8315
End Select

e = e & ChrW(U)
Next i

SciExp = ChrW(183) & "10" & e
End Function

Hope this will help a lot of scientists out there...

Pieter de la Court


This Site

Got a version of Excel that uses the menu interface (Excel 97, Excel 2000, Excel 2002, or Excel 2003)? This site is for you! If you use a later version of Excel, visit our ExcelTips site focusing on the ribbon interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.