Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7618013
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T03:17:22+00:00 2026-05-31T03:17:22+00:00

I have a list of data without 0, so I tried Format Cells->Custom to

  • 0

I have a list of data without 0, so I tried
Format Cells->Custom
to add a leading zero and it works.

But when I click every single cell, the data shown in formula bar still didn’t have the leading zero. For example, in my excel file after custom formatting:
0112244555

But in the formula bar:
112244555

Is there any way to display data with leading zeros as well when I click each of them?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T03:17:24+00:00Added an answer on May 31, 2026 at 3:17 am

    Removing leading zeroes is default behaviour in Excel.

    Your work-around to use a Custom format is standard to show leading zeroes

    If you want to actually embed them then you will need to add an apostrophe
    ie in A1
    '012
    will display
    012

    as text – although you can still perform algebraic manipulation on this cell as if it was entered as a numeric
    12

    Code Solution

    This code will:

    • run on only numeric constant cells in the current selection (ie ignoring blanks, text, formulae)
    • will add two leading zeroes behind an apostrophe

    So if you ran the code on column A below, the result would be the updated cells shown in column C (for demonstration only, the actual updates occur in A1,A4 and A5)

    enter image description here

    Change this line
    strRep = "'00"
    to change the amount of leading zeroes

    ‘Press Alt + F11 to open the Visual Basic Editor (VBE)
    ‘From the
    Menu, choose Insert-Module.
    ‘Paste the code into the right-hand code
    window.
    ‘Press Alt + F11 to close the VBE
    ‘In Xl2003 Goto Tools …
    Macro … Macros and double-click AddLeadingZeros

    Sub AddLeadingZeros()
        Dim rng1 As Range
        Dim rngArea As Range
        Dim strRep As String
        Dim lngRow As Long
        Dim lngCol As Long
        Dim lngCalc As Long
        Dim X()
    
        strRep = "'00"
    
        On Error Resume Next
        'Set rng1 = Application.InputBox("Select range for the replacement of leading zeros", "User select", Selection.Address, , , , , 8)
        Set rng1 = Selection.SpecialCells(xlConstants, xlNumbers)
        If rng1 Is Nothing Then Exit Sub
        On Error GoTo 0
    
       'Speed up the code by turning off screenupdating and setting calculation to manual
       'Disable any code events that may occur when writing to cells
        With Application
            lngCalc = .Calculation
            .ScreenUpdating = False
            .Calculation = xlCalculationManual
            .EnableEvents = False
        End With
    
        'Test each area in the user selected range
    
        'Non contiguous range areas are common when using SpecialCells to define specific cell types to work on
        For Each rngArea In rng1.Areas
            'The most common outcome is used for the True outcome to optimise code speed
            If rngArea.Cells.Count > 1 Then
               'If there is more than once cell then set the variant array to the dimensions of the range area
               'Using Value2 provides a useful speed improvement over Value. On my testing it was 2% on blank cells, up to 10% on non-blanks
                X = rngArea.Value2
                For lngRow = 1 To rngArea.Rows.Count
                    For lngCol = 1 To rngArea.Columns.Count
                        'replace the leading zeroes
                        X(lngRow, lngCol) = strRep & X(lngRow, lngCol)
                    Next lngCol
                Next lngRow
                'Dump the updated array sans leading zeroes back over the initial range
                rngArea.Value2 = X
            Else
                'caters for a single cell range area. No variant array required
                rngArea.Value = strRep & rngArea.Value2
            End If
        Next rngArea
    
        'cleanup the Application settings
        With Application
            .ScreenUpdating = True
            .Calculation = lngCalc
            .EnableEvents = True
        End With
    
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to group some data without much luck. I have a list
I have a list of data points (0.2, 0.8, 0.95) that I want to
I have a list of data in javascript that looks like this: [[152, 48,
I have a list of data that is a schedule. Each item has a
I have a list of data of the form: [line1,a] [line2,c] [line3,b] I want
I have a list and I want to extract to another list the data
I'm a java programmer switching over to C++. I have a list of data
I have a list of core data objects each has a longitude and latitude
I have a long list of data that I want to display in table
I have a list within a data frame (in this example, df$candpct ), and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.