Results 1 to 3 of 3

Thread: puting an apostrophe before a number

  1. #1

    puting an apostrophe before a number

    Register for a FREE account, and/
    or Log in to avoid these ads!


    how do you format numbers to have an apostrophe before all the numbers

    eg. 100 '100
    7 '7

    the are too many of the numbers and can not do it manually, looking for the formula

  2. #2
    Super Moderator Bob Phillips's Avatar
    Join Date
    Mar 2011
    Excel Version
    Public Sub ProcessData()
    Dim Lastrow As Long
    Dim i As Long
        Application.ScreenUpdating = False
        With ActiveSheet
            Lastrow = .Cells(.Rows.Count, "A").End(xlUp).Row
            For i = 1 To Lastrow
                If IsNumeric(.Cells(i, "A").Value) Then
                    .Cells(i, "A").Value = "'" & .Cells(i, "A").Value
                End If
            Next i
        End With
        Application.ScreenUpdating = True
    End Sub

  3. #3
    Administrator Ken Puls's Avatar
    Join Date
    Mar 2011
    Nanaimo, BC, Canada
    Blog Entries
    Excel Version
    Excel Office 365 Insider
    Bob's route will actually put an apostrophe in the cell. If you want them to just look like they have an apostrophe, but still work like numbers, you can use a custom number format:

    • Select the range of cells
    • Right click and choose "Format Cells"
    • Go to the "Number" tab
    • Select "Custom"
    • Under "Type" enter the '0
    • Click OK
    This will display with the apostrophe, but you can still add and subtract them if you need to.

    Ken Puls, FCPA, FCMA, MS MVP

    Learn to Master Your Data at the Power Query Academy (the world's most comprehensive online Power Query training), with my book M is for Data Monkey, or our new Power Query Recipe cards!

    Main Site: -||- Blog: -||- Forums:
    Check out the Excelguru Facebook Fan Page -||- Follow Me on Twitter

    If you've been given VBA code (a macro) for your solution, but don't know where to put it, CLICK HERE.

Posting Permissions

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