PAD

Add leading "0" other characters before a number or string in Google Sheets with PAD

Clean to TypeCyrus Radfar
Jul 7

The PAD function is a tool for creating output that all has the same length.

Commonly, this can be used to "pad" a single digit number with a leading zero so "1" becomes "01". This function is extensible so the user can decide what character to use and what the length should be. By example, it would be possible to turn "1" into "******1", as well.

Function Signature

=PAD(input, pad_length, pad_character)

Argument Definitions

input [range]

  • required - range of cells to transform with padding.

pad_length [number, default = 2]

  • Number of characters that must be padded. Longer length strings will not be truncated.

pad_character [string, default = "0"]

  • Function uses the first character of the given string as the padding character. Ex. if pad_character is "*", input is 1, the return would be "*1"

Use the Cheat

How to Add a Cheat to a Google Sheet

Click the Code Box to Copy

Cheat copied to clipboard ✂️👍
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.

We've built an interactive tutorial in Google Sheets where it's easy to see how the function works. You can read the definition, edit examples, and do some practice examples to verify that you understand how to use the function.

Copy TutorialView TutorialDownload AppScript Code
Create fixed length strings from a number or text input with configurable leading characters.
Cyrus RadfarCyrus Radfar

Cyrus is the friendly full-stack founder of spread_cheats. He's a work optimization fanatic.

He's also working on other projects through V1.

Related Cheats