Help Centre › Functions & Formulas
For a full list of available calculation functions, please read What calculation functions are supported.
Description
The LPAD function adds padding the the left of a given text to make it a certain length. It's particularly useful for ensuring text aligns correctly or meets specific formatting requirements.
Syntax
LPAD(text, width, [char])
- text: Required. The text that is to be padded.
- width: Required. The total number of characters you want in the final string. This includes both the original characters and the added padding.
- char: Optional. A specific character you want to use for padding, instead of the default space character.
Remarks
- If the original text is shorter than totalWidth, LPAD will add spaces (or the specified character) to the end of the text until it reaches the desired length.
- If the original text is already as long as or longer than totalWidth, the function will return the text as is, without adding any extra padding.
Example
| Formula | Description | Result |
| =LPAD("BBQ and Slaw", 15) | As the current length of the text is 12 characters, an additional 3 " " (spaces) are added to the left. | " BBQ and Slaw" |
| =LPAD("BBQ and Slaw", 15, "*") | As the current length of the text is 12 characters, an additional 3 * are added to the left. | "***BBQ and Slaw" |
Errors
For a full list of formula errors, please read Formula errors.