## Example

=TEXT(B3,REPT(“0”,C3))

## Generic Formula

=TEXT(Number,REPT(“0”,N))
• Number – This is the number which you want to add leading zeros to.
• N – This is total number of characters you want in the resulting leading zeros number string.

## What It Does

This formula will add leading zeros to a given number up to a specified number of total characters in the result.

## How It Works

REPT(“0”,N) will create a text string with N zeros. In our example, REPT(“0”,6) results in a text string of 6 zeros “000000“.

The TEXT(Number,”000000″) function will then format any given number as a text string with up to 6 characters for leading zeros. In our example, TEXT(111,”000000″) will result in the text string “000111“.

### John MacDougall

John is a Microsoft MVP and qualified actuary with over 15 years of experience. He has worked in a variety of industries, including insurance, ad tech, and most recently Power Platform consulting. He is a keen problem solver and has a passion for using technology to make businesses more efficient.

## Related Posts

#### How To Conditionally Concatenate A Range

This formula will conditionally concatenate a range based on a criteria in another range.

#### How To Solve a Quadratic Equation

These formulas will give the solutions to a quadratic equation.

#### How To Select A Random Item From A List

This formula will return a random selection from a given list with each item in the list having an equal probability of being selected.