Upcoming database upgrades. Airtable functionality will be reduced for ~15 minutes at 06:00 UTC on Feb. 4 / 10:00 pm PT on Feb. 3. Learn more here
Jun 01, 2021 07:50 PM
Hello!
I’m new on airtable and would love some help creating an IF formula.
Context: I’m trying to create a unique vendor code for SKUs. Ive added an autogenerate number field called “Vendor Number” and added a “vendor code” field where I would like to create the IF formula. I want to to add “00” at the beginning of the vendor number if the vendor number is less than 10, add “0” if the vendor number is less than 100 and show only the “vendor number” if it is greater than 100.
Example:
Vendor Number: 7
Vendor Code: 007
Vendor Number: 19
Vendor Code: 019
Vendor Number: 122
Vendor Code: 122
Any help would be greatly appreciated!
Thanks
Jun 01, 2021 09:39 PM
Hi @Niko_Gomez - you can do this with an IF statement (if length = 1, then prefix with 00 etc), but there’s a neater way:
REPT('0', 3-LEN({Vendor Number} & '')) & {Vendor Number}
Just to break this down:
=======================
Want to learn Airtable Scripting? 1 day bootcamp coming soon!
=======================