Consulting

Results 1 to 4 of 4

Thread: Solved: Convert exponential format to a number ?

  1. #1
    VBAX Expert
    Joined
    Sep 2010
    Posts
    604
    Location

    Solved: Convert exponential format to a number ?

    In Excel 2003 - How can I convert scientific Notation (exponential) to a number using a helper column and formula ?

    7.9838E+11

    In the past I've always used method (1) Shown below, but in this case that's not working.
    (1) select range, Right click -> Format cells -> Number (0 decimal places)

    (2)Right click -> Format cells -> Custom -> Typed in 11 zeros

    If I choose Format cells -> Number (0 decimal places) then Press F2 and Enter, that works but only for one cell at a time.

    Sample workbook attached,

    Thanks
    Attached Files Attached Files

  2. #2
    Moderator VBAX Master geekgirlau's Avatar
    Joined
    Aug 2004
    Location
    Melbourne, Australia
    Posts
    1,464
    Location
    Formula: =INT(P2)

    We are what we repeatedly do. Excellence, therefore, is not an act but a habit.
    Aristotle

  3. #3
    VBAX Guru Kenneth Hobs's Avatar
    Joined
    Nov 2005
    Location
    Tecumseh, OK
    Posts
    4,956
    Location
    For positive exponents, the =Int method will work fine.

    You need to resize the column if you don't want Excel changing numbers to exponent notation.

    For a VBA solution that converts strings for exponents, copy your strings and paste. With those selected cells run this. If you change the numberformat to 0, you will only see 0 for numbers less than 0.

    [VBA]Sub Expo()
    Dim cell As Range, s() As String, lng As Long, n As Integer
    For Each cell In Selection
    With cell
    If Not VarType(.Value2) = vbString Then GoTo NextCell
    s() = Split(cell.Value2, "E")
    .Value2 = s(0) * 1 * (1 * 10 ^ s(1)) 'ePart(s(1))
    .NumberFormat = "General"
    .EntireColumn.AutoFit
    End With
    NextCell:
    Next cell
    End Sub[/VBA]

  4. #4
    VBAX Expert
    Joined
    Sep 2010
    Posts
    604
    Location
    Quote Originally Posted by geekgirlau
    Formula: =INT(P2)
    Thanks geekgirlau, that's what I was after


    Thank you also Kenneth - Your VBA solution I'm sure I will need somewhere down the road

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •