Help

Leftpad using Rept and Len

Topic Labels: Formulas
552 0
cancel
Showing results for 
Search instead for 
Did you mean: 
Rob_Cobb
4 - Data Explorer
4 - Data Explorer

I’m making course codes (like ACT015) from numbers (like 15) and prefixes like “ACT”. The trick is - how to left pad the numbers with 0 when combining them?

The part of the formula to add the right number of '0’s:
REPT(“0”, 3 - LEN(Number&""))

and the whole formula:
CONCATENATE(Prefix, REPT(“0”, 3 - LEN(Number&"")), Number)

Hope this helps someone! I didn’t see any other posts on the first page of results when I googled “airtable formula leftpad”, so had to get creative.

0 Replies 0