Prepends a character to the text until it reaches a length of count.
PADSTART(text, count, character)
text is the text that we want to add padding to.
count is how long you want the new value to be.
character is optional, default is a space if no character is specified, otherwise PADSTART will use the specified character.
Example:
If text contains Hello, count contains 12 and no specified character:
PADSTART("Hello", 12)
returns " Hello"
If text contains Hello, count contains 12 and character contains !:
PADSTART("Hello", 12, "!")
returns "!!!!!!!Hello"
Text:
Count:
Character:
Result:
Imagine you're managing a database for a small library. The library has a system where each book is assigned a unique identifier (BookID). These BookIDs are a combination of a prefix and a number. For consistency and ease of sorting, the numerical part of the BookID must always have a specific number of digits, say, five. However, as new books are added, the numbers are simply incremented (e.g., 1, 2, 3...).
This is where PADSTART becomes incredibly useful. You can use it to automatically format the BookID so that the numerical part is always five digits long, by padding the beginning with zeros.
Here's a table showing how the PADSTART function would work in this scenario:
Original Book Number | PADSTART(Original Book Number, 5, '0') | Final Book ID | ||
|---|---|---|---|---|
A | B | C | ||
1 | 1 | 00001 | LB-00001 | |
2 | 27 | 00027 | LB-00027 | |
3 | 456 | 00456 | LB-00456 | |
4 | 1234 | 01234 | LB-01234 | |
5 | 98765 | 98765 | LB-98765 |
In this example:
The function checks the length of the Book Number. If it's less than five characters, it adds '0's to the beginning until the total length is five. This ensures that every BookID follows a consistent format, making it easier to search, sort, and display in the library's system.
PRODUCT & FEATURES
RESOURCES
Terms | Privacy | Spam Policy
© 2026 Zapof