Formula to create incremental number?

Is there a way to create a formula column for a table to show an incremental number starting from a certain number? So for example, we have a column called: Order Number. We want the first record to start from 3000 and then each record after would increment that number by 1. Is this possible?

Hi there!

This is possible and I would recommend using the record ID so this number is unique for each record. The formula to do this would be:

3000 + $id

Your first records would have order number 3001, record 2 would be 3002 and so on.

We use this same method in our Custom Product Builder template for Contract Number just starting at 500.

Thanks,
Natalie

1 Like

@natalie-grist How would I concatenate a small text (like RSK for Risk) plus an incremental number?

I would like my Risk Register to be like RSK-0001, RSK-0002, RSK-0003, etc

Hi there!

You can use the following formula to achieve this format:

"RSK-{:0>4}".format($id)

"{:0>4}".format($id) takes the unique row ID And formats it to be a minimum of 4 digits. Because we want the formatted number to appear after RSK-, we can add this to the beginning of our string.

Our formula cheat sheet has a similar example of this method as well as an example using the zfill method. Check it out here: Formula Cheat Sheet - Formatting numbers with leading zeros

If you wanted to use the zfill method to accomplish the same thing as above, use this formula:

"RSK-" + str($id).zfill(4)

str($id) converts the Row ID to a string (rather than a numeric value). We use the zfill method to return a copy of the string with the specified number of digits. We add this to our starting string RSK-.

Let me know if you have any other questions!

Thanks,
Natalie

2 Likes