Skip to main content

Excel Formula: Add Leading zero to fix text length

Author: Sun Last Modified: 2020-02-24

If there is a list of numbers in a worksheet, for looking much neater, you may want to add leading zeros to force them in a fixed length as below screenshot shown. In this tutorial, it provides a formula which uses the TEXT function to easily handle this job.
doc abbreviate words 1

Generic formula:

TEXT(txt,"0_length"))

Arguments

Txt: the cell reference or text string you want to fix the length.
0_length: a string of zeros which used to set the length of string you need. Supposing you want to make text length in 6 characters, you can use “000000” in the formula as this TEXT(txt,”000000”)

Remark

This formula will change the cell formatting to text formatting.

This formula only work for number string, if the string is text formatting, it returns the original data.

How this formula work

To fix the numbers in list of cell B3:B8 to five character, please use below formula:

=TEXT(B3,"00000")

Press Enter key and drag fill handle to the cell B8.

Explanation

TEXT function is used to convert numbers to text in a specified formatting.

Sample File

doc sampleClick to download sample file


Relative Formulas


Relative Functions

  • TEXT function
    Convert number to text with a specific format.
  • REPLACE function
    Find and replace characters based on given location from text string with a new text.
  • LEFT function
    Extract characters from left side of text.
  • MID function
    Extract part of text from a cell value based on the location and length.

The Best Office Productivity Tools

Kutools for Excel - Helps You To Stand Out From Crowd

🤖 Kutools AI Aide: Revolutionize data analysis based on: Intelligent Execution   |  Generate Code  |  Create Custom Formulas  |  Analyze Data and Generate Charts  |  Invoke Kutools Functions
Popular Features: Find, Highlight or Identify Duplicates  |  Delete Blank Rows  |  Combine Columns or Cells without Losing Data  |  Round without Formula ...
Super VLookup: Multiple Criteria  |  Multiple Value  |  Across Multi-Sheets  |  Fuzzy Lookup...
Adv. Drop-down List: Easy Drop Down List  |  Dependent Drop Down List  |  Multi-select Drop Down List...
Column Manager: Add a Specific Number of Columns  |  Move Columns  |  Toggle Visibility Status of Hidden Columns  Compare Columns to Select Same & Different Cells ...
Featured Features: Grid Focus  |  Design View  |  Big Formula Bar  |  Workbook & Sheet Manager | Resource Library (Auto Text)  |  Date Picker  |  Combine Worksheets  |  Encrypt/Decrypt Cells  |  Send Emails by List  |  Super Filter  |  Special Filter (filter bold/italic/strikethrough...) ...
Top 15 Toolsets12 Text Tools (Add Text, Remove Characters ...)  |  50+ Chart Types (Gantt Chart ...)  |  40+ Practical Formulas (Calculate age based on birthday ...)  |  19 Insertion Tools (Insert QR Code, Insert Picture from Path ...)  |  12 Conversion Tools (Numbers to Words, Currency Conversion ...)  |  7 Merge & Split Tools (Advanced Combine Rows, Split Excel Cells ...)  |  ... and more

Kutools for Excel Boasts Over 300 Features, Ensuring That What You Need is Just A Click Away...

Description


Office Tab - Enable Tabbed Reading and Editing in Microsoft Office (include Excel)

  • One second to switch between dozens of open documents!
  • Reduce hundreds of mouse clicks for you every day, say goodbye to mouse hand.
  • Increases your productivity by 50% when viewing and editing multiple documents.
  • Brings Efficient Tabs to Office (include Excel), Just Like Chrome, Edge and Firefox.
Comments (0)
No ratings yet. Be the first to rate!
There are no comments posted here yet
Leave your comments
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations