# 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:** 1

<div class="post-metadata">

**Author:** ![MonsterGo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/monstergo/32/18780_2.png) [@MonsterGo](https://community.glideapps.com/u/MonsterGo)\
**Post date:** [December 27, 2020, 9:34pm UTC](https://community.glideapps.com/t/auto-numbering/20355/1 "2020-12-27T21:34:24Z")

</div>

How to setting auto numbering that appear with a new order submit by a form button?

Example, i have 3 form submitted. i need the first submitted form showing:

0001 - “form result; …”  
0002 - “form result; …”  
0003 - “form result; …”

those 0001,0002,0003 auto generate by data backend.

---

<div class="post-metadata">

**Author:** ![Robert\_Petitto](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/robert_petitto/32/25193_2.png) [@Robert\_Petitto](https://community.glideapps.com/u/Robert_Petitto)\
**Post date:** [December 27, 2020, 10:27pm UTC](https://community.glideapps.com/t/auto-numbering/20355/2 "2020-12-27T22:27:19Z")

</div>

Glide cannot natively do this, but you can create an arrayformula in the spreadsheet to auto generate these numbers.

---

<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 27, 2020, 10:42pm UTC](https://community.glideapps.com/t/auto-numbering/20355/3 "2020-12-27T22:42:43Z")

</div>

Here’s a sample arrayformula.

```
={"Auto numbering";ARRAYFORMULA(IF(A2:A="","",TEXT(ROW(A2:A)-1,"0000")))}
```

---

<div class="post-metadata">

**Author:** ![MonsterGo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/monstergo/32/18780_2.png) [@MonsterGo](https://community.glideapps.com/u/MonsterGo)\
**Post date:** [December 27, 2020, 11:07pm UTC](https://community.glideapps.com/t/auto-numbering/20355/4 "2020-12-27T23:07:20Z")

</div>

Can using by Query function to do this ?

---

<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 27, 2020, 11:08pm UTC](https://community.glideapps.com/t/auto-numbering/20355/5 "2020-12-27T23:08:46Z")

</div>

Why do you need a Query for this though? I think it’s too simple to use a Query. If you want to number things after a query then you can use my arrayformula.

---

<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 28, 2020, 12:54am UTC](https://community.glideapps.com/t/auto-numbering/20355/6 "2020-12-28T00:54:08Z")

</div>

> [@Robert\_Petitto](#):
>
> Glide cannot natively do this, but you can create an arrayformula in the spreadsheet to auto generate these numbers.

Yes it can, sortof 😉

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.

PS. I use this method in that thing I shared with you the other night 🙂

---

<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, 12:56am UTC](https://community.glideapps.com/t/auto-numbering/20355/7 "2020-12-28T00:56:40Z")

</div>

But it can’t format the ID as 0001 though, right? 😅

---

<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 28, 2020, 12:59am UTC](https://community.glideapps.com/t/auto-numbering/20355/8 "2020-12-28T00:59:56Z")

</div>

heh, not easily…

but, where there is a will there is usually a way… with a sufficient number of ITE and Template columns 🤣 🤣

---

<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 28, 2020, 1:50am UTC](https://community.glideapps.com/t/auto-numbering/20355/9 "2020-12-28T01:50:44Z")

</div>

I agree with @Darren_Murphy’s method. It’s a lot safer than having a formula create the number…especially using the order number example. Otherwise with an arrayformula and dynamic numbering, it’s too easy to delete one row and have all order numbers get renumbered and messed up. I think the best way is to have one column with just a number and another column with the alpha characters, then build the complete order number with a template column.

I think to get the left padded zeros, you could take the number, divide by 1000, create a template to lock in the value and replace the decimal with nothing.

---

<div class="post-metadata">

**Author:** ![Robert\_Petitto](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/robert_petitto/32/25193_2.png) [@Robert\_Petitto](https://community.glideapps.com/u/Robert_Petitto)\
**Post date:** [December 28, 2020, 2:54am UTC](https://community.glideapps.com/t/auto-numbering/20355/10 "2020-12-28T02:54:53Z")

</div>

So smart. I guess I wasn’t reading the post closely enough…I missed the part about form submission…I was assuming just ordering rows. Jeff’s solution with the template column is clutch.

---

<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 28, 2020, 8:33am UTC](https://community.glideapps.com/t/auto-numbering/20355/11 "2020-12-28T08:33:38Z")

</div>

> [@Jeff\_Hager](#):
>
> I think to get the left padded zeros, you could take the number, divide by 1000, create a template to lock in the value and replace the decimal with nothing.

How would you do the “replace the decimal with nothing” bit?

---

<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 28, 2020, 9:48am UTC](https://community.glideapps.com/t/auto-numbering/20355/12 "2020-12-28T09:48:01Z")

</div>

> [@Jeff\_Hager](#):
>
> I think to get the left padded zeros, you could take the number, divide by 1000, create a template to lock in the value and replace the decimal with nothing.

Here is how I would do it:

 ![Screen Shot 2020-12-28 at 5.43.18 PM](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/7/6/76932a19737e73605db7f5366bfa29f8d9d2b4f4.png)

“Padding” is just a simple ITE…

 ![Screen Shot 2020-12-28 at 5.43.32 PM](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/d/0/d0c09fe89662fbf29618b4a327de53603006f8e9.png)

So putting all that together, 4 columns required:

1. Rollup to determine the current max order ID
2. Math column to increment that by 1
3. ITE column to determine how many zeros required for padding
4. Template column to join 2 & 3

---

<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, 10:40am UTC](https://community.glideapps.com/t/auto-numbering/20355/13 "2020-12-28T10:40:17Z")

</div>

This should be it, well done 😉

---

<div class="post-metadata">

**Author:** ![MonsterGo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/monstergo/32/18780_2.png) [@MonsterGo](https://community.glideapps.com/u/MonsterGo)\
**Post date:** [December 28, 2020, 3:31pm UTC](https://community.glideapps.com/t/auto-numbering/20355/14 "2020-12-28T15:31:57Z")

</div>

this is so smart! but if want to duplicate something between 0001, and 0002. example 0001 i need duplicate to become 0002, and previous 0002 become 0003 and continuous the following number. if i did duplicate in Glide app, my google sheet arrayformula/query will become error.

---

<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 28, 2020, 3:35pm UTC](https://community.glideapps.com/t/auto-numbering/20355/15 "2020-12-28T15:35:51Z")

</div>

My solution is an alternative to the arrayformula.  
So if you use my solution, then the arrayformula isn’t required.

---

<div class="post-metadata">

**Author:** ![MonsterGo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/monstergo/32/18780_2.png) [@MonsterGo](https://community.glideapps.com/u/MonsterGo)\
**Post date:** [December 28, 2020, 4:02pm UTC](https://community.glideapps.com/t/auto-numbering/20355/16 "2020-12-28T16:02:56Z")

</div>

ok! Thank you so much for sharing & teaching!

---

<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 28, 2020, 4:23pm UTC](https://community.glideapps.com/t/auto-numbering/20355/17 "2020-12-28T16:23:48Z")

</div>

I think I was thinking about using a template column and replacing the decimal point there, but trying out, I realize now that you need to have another column with a blank value for the replacement and the template doesn’t seem to like numeric columns as the base template, so it would first have to be converted using another template column to alpha. Seems to work, but ultimately not any more efficient than your 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:** [December 28, 2020, 4:57pm UTC](https://community.glideapps.com/t/auto-numbering/20355/18 "2020-12-28T16:57:46Z")

</div>

Ah, gotcha.  
So something like this, yes?

 ![Screen Shot 2020-12-29 at 12.56.03 AM](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/e/f/ef0c15f27017810e1239b51cd9d56f5ee5583ef4.png)

---

<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 28, 2020, 7:08pm UTC](https://community.glideapps.com/t/auto-numbering/20355/19 "2020-12-28T19:08:45Z")

</div>

yep!

---

<div class="post-metadata">

**Author:** ![Gerard\_Fernandez](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/gerard_fernandez/32/1183_2.png) [@Gerard\_Fernandez](https://community.glideapps.com/u/Gerard_Fernandez)\
**Post date:** [December 28, 2020, 10:19pm UTC](https://community.glideapps.com/t/auto-numbering/20355/20 "2020-12-28T22:19:54Z")

</div>

If there are a lot of simultaneous submissions, are you sure 2 or more rows will not take the same Roll UP +1 and consequently 2 rows will have the same number??

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