# Consecutive Row Numbers?

**URL:** <https://connect.superhuman.com/t/consecutive-row-numbers/317>\
**Category:** Tips and Hacks\
**Created:** [March 15, 2018, 7:18pm UTC](https://connect.superhuman.com/t/consecutive-row-numbers/317 "2018-03-15T19:18:03Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![zoglow](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/zoglow/32/6033_2.png) [@zoglow](https://connect.superhuman.com/u/zoglow)\
**Post date:** [March 15, 2018, 7:18pm UTC](https://connect.superhuman.com/t/consecutive-row-numbers/317/1 "2018-03-15T19:18:03Z")

</div>

I know there must be a simple solution to this, but I cannot find it for the life of me.

So, I need to have a column where each row has a unique consecutive number ranging from 1 to however many rows I have. I cant use rowId because if I delete any rows and then add new ones, the number will be wrong.

Such a simple problem, but it is holding nearly all of my docs back from being made correctly 😷

---

<div class="post-metadata">

**Author:** ![chris\_homburger](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/chris_homburger/32/6673_2.png) [@chris\_homburger](https://connect.superhuman.com/u/chris_homburger)\
**Post date:** [March 15, 2018, 8:06pm UTC](https://connect.superhuman.com/t/consecutive-row-numbers/317/2 "2018-03-15T20:06:34Z")

</div>

@zoglow to confirm, you need a unique, consecutive, and static (does not change on deletion/addition) Row ID? The formula `=rowID(thisRow)` has been working for me to do this.

On the other hand, if you’re looking for a unique, consecutive, and dynamic (changes with delete/add, so that the series is always constant) ID, I think I have it. It’s a little hacky.

In your table, make a column Static Row ID `=rowID(thisRow)` as above. Then, make a column Dynamic Row ID with the formula:

`=thisTable.CountIf(RowId(thisRow) > [Static Row ID])`.

This counts the number of rows that existed _before_ this row, essentially. I suppose you could also use one of the metadata functions to complete this, which may be faster. The trick, though, is that you need to store the comparison value in a column in order to use it in CountIf()—to my knowledge, at least.

Is that what you’re looking for?

---

<div class="post-metadata">

**Author:** ![zoglow](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/zoglow/32/6033_2.png) [@zoglow](https://connect.superhuman.com/u/zoglow)\
**Post date:** [March 15, 2018, 8:15pm UTC](https://connect.superhuman.com/t/consecutive-row-numbers/317/3 "2018-03-15T20:15:43Z")

</div>

Thanks so much, that second one seems to have done the trick!

---

<div class="post-metadata">

**Author:** ![mallika](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/mallika/32/12981_2.png) [@mallika](https://connect.superhuman.com/u/mallika)\
**Post date:** [March 16, 2018, 5:19am UTC](https://connect.superhuman.com/t/consecutive-row-numbers/317/4 "2018-03-16T05:19:10Z")

</div>

Another option that I use is Rank to do this.

Rank(RowID,thisTable.RowID,true )

 ![](https://cl.ly/ef2338d78b95/Screen%20Recording%202018-10-18%20at%2003.18%20PM.gif)

---

<div class="post-metadata">

**Author:** ![zoglow](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/zoglow/32/6033_2.png) [@zoglow](https://connect.superhuman.com/u/zoglow)\
**Post date:** [March 16, 2018, 5:56am UTC](https://connect.superhuman.com/t/consecutive-row-numbers/317/5 "2018-03-16T05:56:38Z")

</div>

Oh, that’s lovely! Thanks!

---

<div class="post-metadata">

**Author:** ![Jonas\_Hoglund](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/jonas_hoglund/32/5716_2.png) [@Jonas\_Hoglund](https://connect.superhuman.com/u/Jonas_Hoglund)\
**Post date:** [November 13, 2018, 11:49am UTC](https://connect.superhuman.com/t/consecutive-row-numbers/317/6 "2018-11-13T11:49:51Z")

</div>

> [@mallika](#):
>
> Rank(RowID,thisTable.RowID,true )

Is there a way to keep the Rank ID ascending ordered even if you move rows around in the table?

---

<div class="post-metadata">

**Author:** ![Krunal\_Sheth](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/krunal_sheth/32/5936_2.png) [@Krunal\_Sheth](https://connect.superhuman.com/u/Krunal_Sheth)\
**Post date:** [November 13, 2018, 5:27pm UTC](https://connect.superhuman.com/t/consecutive-row-numbers/317/7 "2018-11-13T17:27:22Z")

</div>

Yes Jonas please use rank column as a column for sort.

 ![image](https://global.discourse-cdn.com/coda1/original/2X/0/0c6becdfda466e77e4b3a6af73bfe6b15007264e.png)

---

<div class="post-metadata">

**Author:** ![Jonas\_Hoglund](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/jonas_hoglund/32/5716_2.png) [@Jonas\_Hoglund](https://connect.superhuman.com/u/Jonas_Hoglund)\
**Post date:** [November 13, 2018, 6:45pm UTC](https://connect.superhuman.com/t/consecutive-row-numbers/317/8 "2018-11-13T18:45:39Z")

</div>

That will not cut it as I don’t want the rest of the table to be re-sorted. I need a way to reference the previous row in a table and was hoping to use your Rank formula to create a row index I can reference, but I need to have it always stay absolute top to bottom, independent of if the user sorts the table or repositions rows. Not sure if I make my self clear, but let me know if you can think of another option

---

<div class="post-metadata">

**Author:** ![Jonas\_Hoglund](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/jonas_hoglund/32/5716_2.png) [@Jonas\_Hoglund](https://connect.superhuman.com/u/Jonas_Hoglund)\
**Post date:** [November 13, 2018, 7:31pm UTC](https://connect.superhuman.com/t/consecutive-row-numbers/317/9 "2018-11-13T19:31:05Z")

</div>

I’m building an agenda for a workshop and want to achieve the same result as in this thread [Cumulative Start Times for Event Schedule](https://connect.superhuman.com/t/cumulative-start-times-for-event-schedule/1183). The user would set the start time and then set duration per activity (row). The formula I need is to populate a Start Time column automatically for each activity (row) calculated on start time + duration of all previous activities (rows). The formula in linked thread above works as a solution, until the user moves a row to a new position in the table.

---

<div class="post-metadata">

**Author:** ![Krunal\_Sheth](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/krunal_sheth/32/5936_2.png) [@Krunal\_Sheth](https://connect.superhuman.com/u/Krunal_Sheth)\
**Post date:** [November 13, 2018, 7:38pm UTC](https://connect.superhuman.com/t/consecutive-row-numbers/317/10 "2018-11-13T19:38:17Z")

</div>

Does this [answer](https://connect.superhuman.com/t/use-button-to-insert-row-below-current-row/3394/2?u=krunal_sheth) help? we would be happy to work with you if you reach us via in app chat.

---

<div class="post-metadata">

**Author:** ![Jonas\_Hoglund](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/jonas_hoglund/32/5716_2.png) [@Jonas\_Hoglund](https://connect.superhuman.com/u/Jonas_Hoglund)\
**Post date:** [November 13, 2018, 7:45pm UTC](https://connect.superhuman.com/t/consecutive-row-numbers/317/11 "2018-11-13T19:45:25Z")

</div>

Thanks. I will look at this tomorrow as it’s getting late in my time zone (Stockholm). What time zone are you in or do you have 24 hours support?

---

<div class="post-metadata">

**Author:** ![Krunal\_Sheth](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/krunal_sheth/32/5936_2.png) [@Krunal\_Sheth](https://connect.superhuman.com/u/Krunal_Sheth)\
**Post date:** [November 13, 2018, 7:46pm UTC](https://connect.superhuman.com/t/consecutive-row-numbers/317/12 "2018-11-13T19:46:53Z")

</div>

We are available on weekdays usually between 9AM-5PM Pacific standard Time.

---

<div class="post-metadata">

**Author:** ![Jonas\_Hoglund](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/jonas_hoglund/32/5716_2.png) [@Jonas\_Hoglund](https://connect.superhuman.com/u/Jonas_Hoglund)\
**Post date:** [November 13, 2018, 8:05pm UTC](https://connect.superhuman.com/t/consecutive-row-numbers/317/13 "2018-11-13T20:05:21Z")

</div>

Here is a link to the Excel file I’m trying to redo in Coda. It needs to be open in Excel to work as intended. As you will be able to see, the formula in A5-A19 automatically calculates correct start time based on previous rows start time and duration and the start time will continue stay correct if you move a row up or down. Can you think of a way to reproduce this in coda?

[https://drive.google.com/file/d/1vi3ty8vjQId9U3G82wIvvino0xuM9BlO/view?usp=sharing](https://drive.google.com/file/d/1vi3ty8vjQId9U3G82wIvvino0xuM9BlO/view?usp=sharing)

---

<div class="post-metadata">

**Author:** ![Krunal\_Sheth](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/krunal_sheth/32/5936_2.png) [@Krunal\_Sheth](https://connect.superhuman.com/u/Krunal_Sheth)\
**Post date:** [November 13, 2018, 8:29pm UTC](https://connect.superhuman.com/t/consecutive-row-numbers/317/14 "2018-11-13T20:29:32Z")

</div>

Thanks Jonas for sharing Excel - I understand what you are trying to do now. Here’s [a post](https://connect.superhuman.com/t/visual-position-of-the-row-in-table/3404) I made to find visual position of the record as I think it would help others as well -

I think it should be straight forward for you to update start time now that you know visual position. 🙂

Thank you,  
Krunal.  
Engineer - Coda

---

<div class="post-metadata">

**Author:** ![Jonas\_Hoglund](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/jonas_hoglund/32/5716_2.png) [@Jonas\_Hoglund](https://connect.superhuman.com/u/Jonas_Hoglund)\
**Post date:** [November 13, 2018, 8:34pm UTC](https://connect.superhuman.com/t/consecutive-row-numbers/317/15 "2018-11-13T20:34:31Z")

</div>

Excellent and thanks for quick reply

---

<div class="post-metadata">

**Author:** ![Krunal\_Sheth](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/krunal_sheth/32/5936_2.png) [@Krunal\_Sheth](https://connect.superhuman.com/u/Krunal_Sheth)\
**Post date:** [November 13, 2018, 8:50pm UTC](https://connect.superhuman.com/t/consecutive-row-numbers/317/16 "2018-11-13T20:50:00Z")

</div>

here’s a [document](https://coda.io/d/Schedule_doEdQ7j9ly8/Section-1_suhhf#_lu7fu) in case if you want to take a look.

 ![Schedule](https://global.discourse-cdn.com/coda1/original/2X/8/8977226e210617a485cf9271d1506489481ee797.gif)

---

<div class="post-metadata">

**Author:** ![Jonas\_Hoglund](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/jonas_hoglund/32/5716_2.png) [@Jonas\_Hoglund](https://connect.superhuman.com/u/Jonas_Hoglund)\
**Post date:** [November 14, 2018, 9:25am UTC](https://connect.superhuman.com/t/consecutive-row-numbers/317/17 "2018-11-14T09:25:59Z")

</div>

Thanks for this. It solved my problem and here’s a version of my final doc [https://coda.io/d/Team-Train-Agenda\_dddMwh-c5Fi/Agenda\_suebT#\_luDKo](https://coda.io/d/Team-Train-Agenda_dddMwh-c5Fi/Agenda_suebT#_luDKo)

---

<div class="post-metadata">

**Author:** ![Daniel\_Stieber](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/daniel_stieber/32/17045_2.png) [@Daniel\_Stieber](https://connect.superhuman.com/u/Daniel_Stieber)\
**Post date:** [November 16, 2018, 7:02am UTC](https://connect.superhuman.com/t/consecutive-row-numbers/317/18 "2018-11-16T07:02:55Z")

</div>

I still think rowNumber would be useful as a property column besides row Id or maybe just accessable via a formula like rowNumber().

Also something like previous() or next() to access the surrounding rows in the current order would have been useful in math tables on one or the other day.

it feels weird to see the row numbers in grey on the left anyway, but just not be able to use it.

---

<div class="post-metadata">

**Author:** ![Joseph\_B](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/joseph_b/32/6636_2.png) [@Joseph\_B](https://connect.superhuman.com/u/Joseph_B)\
**Post date:** [November 16, 2018, 6:51pm UTC](https://connect.superhuman.com/t/consecutive-row-numbers/317/19 "2018-11-16T18:51:14Z")

</div>

I second @Daniel_Stieber

---

<div class="post-metadata">

**Author:** ![tomavatars](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/tomavatars/32/6130_2.png) [@tomavatars](https://connect.superhuman.com/u/tomavatars)\
**Post date:** [November 16, 2018, 8:21pm UTC](https://connect.superhuman.com/t/consecutive-row-numbers/317/20 "2018-11-16T20:21:02Z")

</div>

I third Daniel 😊  
This would simplified many operations.

[Next page](https://connect.superhuman.com/t/consecutive-row-numbers/317.md?page=2)
