# Average Time between Row Entries

**URL:** <https://community.glideapps.com/t/average-time-between-row-entries/45264>\
**Category:** Ask for Help\
**Created:** [July 26, 2022, 3:47pm UTC](https://community.glideapps.com/t/average-time-between-row-entries/45264 "2022-07-26T15:47:40Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![TylerH](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/tylerh/32/34785_2.png) [@TylerH](https://community.glideapps.com/u/TylerH)\
**Post date:** [July 26, 2022, 3:47pm UTC](https://community.glideapps.com/t/average-time-between-row-entries/45264/1 "2022-07-26T15:47:40Z")

</div>

I have a sheet with form submissions that include a date column, a customer row ID and a relation to this data in the “customer” table. Each customer will have multiple rows, each with timestamp date. I’m looking to have a column that computes the average time between row entries, for each customer, rounded to days. Is this possible in glide or do I need to do this in sheets?

I already have a column that counts the current days since last entry, but i’m already 1700 entries deep and hundreds of customers, so I can’t back-calculate each one easily. Going forward I know I could just submit the “days since last entry” as another piece of data in another column and then just average that data itself, but if it can stay as a reliable formula, that would be best.

---

<div class="post-metadata">

**Author:** ![Uzo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/uzo/32/22639_2.png) [@Uzo](https://community.glideapps.com/u/Uzo)\
**Post date:** [July 26, 2022, 3:52pm UTC](https://community.glideapps.com/t/average-time-between-row-entries/45264/2 "2022-07-26T15:52:22Z")

</div>

yes, use if-else column to extract sign-in user records… then use the rollup column to get the average… you might do some math with dates to get durations

---

<div class="post-metadata">

**Author:** ![TylerH](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/tylerh/32/34785_2.png) [@TylerH](https://community.glideapps.com/u/TylerH)\
**Post date:** [July 26, 2022, 3:54pm UTC](https://community.glideapps.com/t/average-time-between-row-entries/45264/3 "2022-07-26T15:54:15Z")

</div>

Sorry, I forgot to mention, these are form submissions.

---

<div class="post-metadata">

**Author:** ![Uzo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/uzo/32/22639_2.png) [@Uzo](https://community.glideapps.com/u/Uzo)\
**Post date:** [July 26, 2022, 3:56pm UTC](https://community.glideapps.com/t/average-time-between-row-entries/45264/4 "2022-07-26T15:56:48Z")

</div>

no different… data is data

---

<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:** [July 27, 2022, 12:53am UTC](https://community.glideapps.com/t/average-time-between-row-entries/45264/5 "2022-07-27T00:53:23Z")

</div>

My idea is like this:

- Add a rowID column in your submissions table.
- Create a multiple self-relation from the customer ID column in the submissions table, to itself.
- Return a lookup on top of that self-relation, returning all the rowIDs.
- Use a “find element index” column to return the index of each row, within each own customer’s group.

You would get the index column like this.

| Date | Customer ID | Index |
| --- | --- | --- |
| 22 July 2022 | A1 | 0 |
| 23 July 2022 | A2 | 0 |
| 24 July 2022 | A1 | 1 |

Then, add a math column to calculate the “previous index”. It would be Index minus 1.

| Date | Customer ID | Index | Previous Index |
| --- | --- | --- | --- |
| 22 July 2022 | A1 | 0 | -1 |
| 23 July 2022 | A2 | 0 | -1 |
| 24 July 2022 | A1 | 1 | 0 |

Create a template to join the customer ID and the previous index so it looks like “A1 || -1”, “A1 || 0” etc.

Create a template to join the customer ID and the current index (Index column).

Create a single relation from the previous index template column, to the current index template column.

Add a lookup column on top of the relation above, to return the “previous timestamp”.

Add a “Date Difference” column to calculate the difference between each row’s timestamp and the previous timestamp.

Add a rollup to get the average of “Date Difference”.

Not sure it would generate a bit of a bug for the first entry (since there’s nothing before it), so let me know how it goes.

---

<div class="post-metadata">

**Author:** ![TylerH](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/tylerh/32/34785_2.png) [@TylerH](https://community.glideapps.com/u/TylerH)\
**Post date:** [July 27, 2022, 6:56pm UTC](https://community.glideapps.com/t/average-time-between-row-entries/45264/6 "2022-07-27T18:56:08Z")

</div>

I’m stunned that you did this. I’ve spent 4+ hours racking my brain with index, match and lookup arrays in sheets. This was so elegantly explained! Thank 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:** [July 28, 2022, 1:09am UTC](https://community.glideapps.com/t/average-time-between-row-entries/45264/7 "2022-07-28T01:09:10Z")

</div>

Glad it worked for you! Let us know if you have any other questions.

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/system/32/53398_2.png) [@system](https://community.glideapps.com/u/system)\
**Post date:** [July 29, 2022, 1:09am UTC](https://community.glideapps.com/t/average-time-between-row-entries/45264/8 "2022-07-29T01:09:38Z")

</div>

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.
