# Auto Numbering

**URL:** <https://community.glideapps.com/t/auto-numbering/20355>\
**Category:** Ask for Help\
**Created:** [December 27, 2020, 9:34pm UTC](https://community.glideapps.com/t/auto-numbering/20355 "2020-12-27T21:34:24Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [December 28, 2020, 11:01pm UTC](https://community.glideapps.com/t/auto-numbering/20355/21 "2020-12-28T23:01:10Z")

</div>

Interesting question. I’m not quite sure if 2 people goes into an add action at the same time, will the numbering stand corrected? Would a little difference in time enough for the “next” column to recalculate?

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [December 29, 2020, 12:39am UTC](https://community.glideapps.com/t/auto-numbering/20355/22 "2020-12-29T00:39:39Z")

</div>

I’ve seen evidence that compound actions suffer from [race conditions](https://community.glideapps.com/t/action-sequencing-blocking-or-non-blocking/19601).  
This is different, and of course I don’t know the answer, but my guess would be yes it’s possible.  
My understanding is that all these calculations happen client-side, so that probably makes it even more likely that a collision is possible. @Jeff_Hager, thoughts?

---

<div class="post-metadata">

**Author:** ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)\
**Post date:** [December 29, 2020, 4:25am UTC](https://community.glideapps.com/t/auto-numbering/20355/23 "2020-12-29T04:25:54Z")

</div>

I would have to agree. I’ve never done any heavy testing on this theory, and like you said, the calculations happen on the device, so it takes a few seconds to sync back to the server and populate the update to other users. Combining this count with some sort of ID or value that’s unique to a user, would probably help for keeping values unique, but yes, this doesn’t cover all situations where sequential numbering is absolutely necessary. In that case, the only thing that I would trust is a script.

Two things I think we need from glide:

- A function similar to the RowID column that would automatically number rows sequentially, but also make the number stay static forever.
- A rank column that would let us dynamically number a column (as a bonus, let us number based on a particular sort order we choose, or number within a relation).

---

<div class="post-metadata">

**Author:** ![Krivo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/krivo/32/5363_2.png) [@Krivo](https://community.glideapps.com/u/Krivo)\
**Post date:** [December 29, 2020, 8:31am UTC](https://community.glideapps.com/t/auto-numbering/20355/24 "2020-12-29T08:31:03Z")

</div>

@Jeff_Hager and @Darren_Murphy thanks for pointing this out. I considered changing my setup to the suggested setup. But with the mentioned problem it is not time for changing.

Concerning whether the number should never change - this is beneficial in some cases but I also need a sequential numbering to be used for traversing a list by used of increment action. If you delete a row then the numbering of the following rows should change. From the current row I need to know which row is previous and which is next.

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [December 29, 2020, 8:45am UTC](https://community.glideapps.com/t/auto-numbering/20355/25 "2020-12-29T08:45:03Z")

</div>

> [@Krivo](#):
>
> Concerning whether the number should never change - this is beneficial in some cases but I also need a sequential numbering to be used for traversing a list by used of increment action. If you delete a row then the numbering of the following rows should change. From the current row I need to know which row is previous and which is next.

mmm, so that’s an example of where the arrayformula solution works best, because if/when rows are deleted it will automagically renumber the remaining rows.

---

<div class="post-metadata">

**Author:** ![Krivo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/krivo/32/5363_2.png) [@Krivo](https://community.glideapps.com/u/Krivo)\
**Post date:** [December 29, 2020, 8:52am UTC](https://community.glideapps.com/t/auto-numbering/20355/26 "2020-12-29T08:52:00Z")

</div>

@Darren_Murphy exactly. So a similar functionality like arrayformula in glide builder would be appreciated a lot

---

<div class="post-metadata">

**Author:** ![Krivo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/krivo/32/5363_2.png) [@Krivo](https://community.glideapps.com/u/Krivo)\
**Post date:** [December 29, 2020, 8:58am UTC](https://community.glideapps.com/t/auto-numbering/20355/27 "2020-12-29T08:58:52Z")

</div>

@Darren_Murphy maybe the need is really next/previous one in the list when it has been filtered and sorted by X,Y parameters.  
Or give me the item 10 places from here in the list

---

<div class="post-metadata">

**Author:** ![biha](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/biha/32/84110_2.png) [@biha](https://community.glideapps.com/u/biha)\
**Post date:** [March 8, 2021, 1:18am UTC](https://community.glideapps.com/t/auto-numbering/20355/28 "2021-03-08T01:18:05Z")

</div>

I have tried. USer have to enter the user id isnt it?

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [March 8, 2021, 1:27am UTC](https://community.glideapps.com/t/auto-numbering/20355/29 "2021-03-08T01:27:48Z")

</div>

Sorry, I don’t understand your question.

Please show what you have that isn’t working as you would expect.

---

<div class="post-metadata">

**Author:** ![biha](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/biha/32/84110_2.png) [@biha](https://community.glideapps.com/u/biha)\
**Post date:** [March 8, 2021, 1:33am UTC](https://community.glideapps.com/t/auto-numbering/20355/30 "2021-03-08T01:33:55Z")

</div>

My intention was the user no need to enter any number.  
The quotation number is generated by the system itself.  
The admin will start the starting number only.  
For example , me set up the 1000 and once row is added, automatically 1001.  
From this method , the user have to fill in the ID number. correct?

**Let’s say the destination column is called ‘Order ID’.**  
**Create a Rollup column that takes the Max of Order ID - call that MaxOrderID.**  
**Then create a Math column that is MaxOrderID + 1 - call that NextOrderID.**  
**And NextOrderID is then used in the form submission.**

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [March 8, 2021, 1:49am UTC](https://community.glideapps.com/t/auto-numbering/20355/31 "2021-03-08T01:49:04Z")

</div>

No, if you set that up correctly as I described, then the next order ID is already available.  
You just use the value in that column (NextOrderID) to populate the OrderID column when a new order is submitted.

---

<div class="post-metadata">

**Author:** ![biha](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/biha/32/84110_2.png) [@biha](https://community.glideapps.com/u/biha)\
**Post date:** [March 8, 2021, 1:53am UTC](https://community.glideapps.com/t/auto-numbering/20355/32 "2021-03-08T01:53:48Z")

</div>

**Let’s say the destination column is called ‘Order ID’.**  
**Create a Rollup column that takes the Max of Order ID - call that MaxOrderID.**  
**Then create a Math column that is MaxOrderID + 1 - call that NextOrderID.**  
**And NextOrderID is then used in the form submission.**

Let say in my situation as below,

your Order ID is my ID to start  
your MaxOrderID is my Cumulative num  
Your NextOrderID is my Roll up+1  
Then that is my results

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/e/8/e827177956c5eeae5067cf61b8baeb093fd5e552.png)

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [March 8, 2021, 2:00am UTC](https://community.glideapps.com/t/auto-numbering/20355/33 "2021-03-08T02:00:36Z")

</div>

Okay, a picture tells a thousand words 🙂

My solution will only apply for new rows that are added. It won’t automatically apply to pre-existing rows.  
And (it case it wasn’t clear), you need to populate your “ID to Start” column (using the value in “Roll Up +1” as part of the Add Row action that creates a new row.

---

<div class="post-metadata">

**Author:** ![biha](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/biha/32/84110_2.png) [@biha](https://community.glideapps.com/u/biha)\
**Post date:** [March 8, 2021, 2:18am UTC](https://community.glideapps.com/t/auto-numbering/20355/34 "2021-03-08T02:18:26Z")

</div>

Now I understand.  
Populating the add row function.  
Thanks a lot!

---

<div class="post-metadata">

**Author:** ![biha](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/biha/32/84110_2.png) [@biha](https://community.glideapps.com/u/biha)\
**Post date:** [March 8, 2021, 2:53am UTC](https://community.glideapps.com/t/auto-numbering/20355/35 "2021-03-08T02:53:08Z")

</div>

But I have continuous question .  
Eg . the quotation number is GE-2103-1001-Rev.0.  
On edit, the revision 0 at the back will change to Rev.1 , Rev.2 and so on.  
How to make if ID is same and edit the revision number will be adding.

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [March 8, 2021, 5:07am UTC](https://community.glideapps.com/t/auto-numbering/20355/36 "2021-03-08T05:07:36Z")

</div>

You should be able to do that with a template column that takes the base quotation number, and appends the increment to the end of it.

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [March 9, 2021, 9:05am UTC](https://community.glideapps.com/t/auto-numbering/20355/37 "2021-03-09T09:05:34Z")

</div>

> [@ThinhDinh](#):
>
> Here’s a sample arrayformula.
> 
> ```auto
> ={"Auto numbering";ARRAYFORMULA(IF(A2:A="","",TEXT(ROW(A2:A)-1,"0000")))}
> 
> ```

@ThinhDinh you’re better with these types of formulas than I am 😉

How would you adjust the above such that it starts auto-incrementing from 1, and applies to a specific number of rows? For example:

- I want to start auto-incrementing at row 20, and continue for 50 rows
- Then at row 100, I want to start again from 1 and continue for another 100 rows
- etc, etc

The row counts above are arbitrary and random - I’m just looking for a general approach. ie. I want to wind up with something that looks like this:

 ![Screen Shot 2021-03-09 at 5.04.21 PM](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/1/7/1702d77ee7b111b7ebbbd6f005396f080c70718d.png)

EDIT: Never mind, I figured it out. I was just being lazy 🤣 🤣

`=ARRAYFORMULA(ROW(C454:C466)-453)`

That would start counting from 1 at row 454, and continue until row 466…

![Screen Shot 2021-03-09 at 5.18.27 PM](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/d/b/db81d88c2f15ecbe6f2120f18e2bd7d34ba7592c.png)

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [March 9, 2021, 12:38pm UTC](https://community.glideapps.com/t/auto-numbering/20355/38 "2021-03-09T12:38:59Z")

</div>

Good solution 😉

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [March 9, 2021, 1:03pm UTC](https://community.glideapps.com/t/auto-numbering/20355/39 "2021-03-09T13:03:49Z")

</div>

Actually, yes and no.  
My use case for this is that I have a sheet with several logical groupings of rows.  
And for each group, I want an auto-incrementing column from 1-n  
So I’ve inserted the above formula pattern in the first row of each group, and it works, but…

If I insert a column into any of the groups, then the number sequence in all groups below it is immediately offset by one… so instead of starting at 1, they start at 2. In typing this out, I’ve realised that this happens because the return value of row() changes, but I can’t think of a way to get around it - can you?

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [March 9, 2021, 2:21pm UTC](https://community.glideapps.com/t/auto-numbering/20355/40 "2021-03-09T14:21:59Z")

</div>

Something like this I guess?

> [@Arrayformula for incremental serial number dependent on another column](https://community.glideapps.com/t/arrayformula-for-incremental-serial-number-dependent-on-another-column/7975/2):
>
> Hi Manan, You can try =ARRAYFORMULA(IF(A2:A\<\>"",COUNTIFS(A2:A,A2:A,ROW(A2:A),"\<="&ROW(A2:A)),"")) Explanation: A2:A\<\>"" : To only number the rows that have data in A COUNTIFS: Only consider rows that have the same project name (A2:A, A2:A) and apply a dynamic range containing only from the start of the column to that specific row (ROW(A2:A), \<=&ROW(A2:A) Please try and get back to me if you need more help. [image]

[Previous page](https://community.glideapps.com/t/auto-numbering/20355.md?page=1)

[Next page](https://community.glideapps.com/t/auto-numbering/20355.md?page=3)
