# How to Keep Formula While Adding New Lines to Database

**URL:** <https://community.glideapps.com/t/how-to-keep-formula-while-adding-new-lines-to-database/25274>\
**Category:** Ask for Help\
**Created:** [April 7, 2021, 8:55pm UTC](https://community.glideapps.com/t/how-to-keep-formula-while-adding-new-lines-to-database/25274 "2021-04-07T20:55:23Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Keith\_Chikumbirike](https://avatars.discourse-cdn.com/v4/letter/k/5daacb/32.png) [@Keith\_Chikumbirike](https://community.glideapps.com/u/Keith_Chikumbirike)\
**Post date:** [April 7, 2021, 8:55pm UTC](https://community.glideapps.com/t/how-to-keep-formula-while-adding-new-lines-to-database/25274/1 "2021-04-07T20:55:23Z")

</div>

I have dynamic sum formulae in a certain sheet making critical calculations for my app. However, if I add an entry in the app, the formula is discontinued yet I want the same formulae applied to the data in the new entries

---

<div class="post-metadata">

**Author:** ![V88](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/v88/32/90054_2.png) [@V88](https://community.glideapps.com/u/V88)\
**Post date:** [April 7, 2021, 9:01pm UTC](https://community.glideapps.com/t/how-to-keep-formula-while-adding-new-lines-to-database/25274/2 "2021-04-07T21:01:18Z")

</div>

You probably need an Array Formula. There is LOTS of info in this forum. Just do a quick search.

---

<div class="post-metadata">

**Author:** ![Keith\_Chikumbirike](https://avatars.discourse-cdn.com/v4/letter/k/5daacb/32.png) [@Keith\_Chikumbirike](https://community.glideapps.com/u/Keith_Chikumbirike)\
**Post date:** [April 7, 2021, 9:03pm UTC](https://community.glideapps.com/t/how-to-keep-formula-while-adding-new-lines-to-database/25274/3 "2021-04-07T21:03:17Z")

</div>

i tried on though, let me check for more topics. thanks

---

<div class="post-metadata">

**Author:** ![V88](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/v88/32/90054_2.png) [@V88](https://community.glideapps.com/u/V88)\
**Post date:** [April 7, 2021, 9:07pm UTC](https://community.glideapps.com/t/how-to-keep-formula-while-adding-new-lines-to-database/25274/4 "2021-04-07T21:07:00Z")

</div>

[https://docs.glideapps.com/all/reference/using-sheets/functions/arrayformula](https://docs.glideapps.com/all/reference/using-sheets/functions/arrayformula)

Might be useful

---

<div class="post-metadata">

**Author:** ![Keith\_Chikumbirike](https://avatars.discourse-cdn.com/v4/letter/k/5daacb/32.png) [@Keith\_Chikumbirike](https://community.glideapps.com/u/Keith_Chikumbirike)\
**Post date:** [April 7, 2021, 9:09pm UTC](https://community.glideapps.com/t/how-to-keep-formula-while-adding-new-lines-to-database/25274/5 "2021-04-07T21:09:39Z")

</div>

thank you so much  
taking a look now

---

<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:** [April 7, 2021, 11:12pm UTC](https://community.glideapps.com/t/how-to-keep-formula-while-adding-new-lines-to-database/25274/6 "2021-04-07T23:12:25Z")

</div>

> [@Tutorial: Arrayformula in Google Sheets, good practices & how to overcome Arrayformula restrictions with scripts](https://community.glideapps.com/t/tutorial-arrayformula-in-google-sheets-good-practices-how-to-overcome-arrayformula-restrictions-with-scripts/9727):
>
> Hi, Today I will show you the script that can make copying formulas down work, when it does not work with arrayformula. But first, let’s have some introductions about arrayformula, for those who has not used this before in Google Sheets, some equivalents in Glide and some good practices while using it. I hope it can help you in building your Glide apps as well as applying it in your normal day job. 
> 
> > **1/ Definition**
> >
> > Arrayformula is defined as “a range, mathematical expression using one cell range …

Hope this helps.

---

<div class="post-metadata">

**Author:** ![Keith\_Chikumbirike](https://avatars.discourse-cdn.com/v4/letter/k/5daacb/32.png) [@Keith\_Chikumbirike](https://community.glideapps.com/u/Keith_Chikumbirike)\
**Post date:** [April 9, 2021, 3:37am UTC](https://community.glideapps.com/t/how-to-keep-formula-while-adding-new-lines-to-database/25274/7 "2021-04-09T03:37:36Z")

</div>

Thank you so much. I’m learning more about array formulas indeed. Much appreciated

---

<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:** [April 9, 2021, 4:16am UTC](https://community.glideapps.com/t/how-to-keep-formula-while-adding-new-lines-to-database/25274/8 "2021-04-09T04:16:07Z")

</div>

Feel free to let us know if you need help.

---

<div class="post-metadata">

**Author:** ![Keith\_Chikumbirike](https://avatars.discourse-cdn.com/v4/letter/k/5daacb/32.png) [@Keith\_Chikumbirike](https://community.glideapps.com/u/Keith_Chikumbirike)\
**Post date:** [April 10, 2021, 6:27pm UTC](https://community.glideapps.com/t/how-to-keep-formula-while-adding-new-lines-to-database/25274/9 "2021-04-10T18:27:41Z")

</div>

Definitely, I do need help.

I have 2 separate sheets; one with lists of products and I want them to be summed up depending on category and project in the second sheet. Hence I’m running a dynamic sumif formula to sum up the products.

Here is a link with an example of the scenario I’m facing:  
[https://docs.google.com/spreadsheets/d/1XYuuxtlPOgE2h5cwVePRG92urNVr\_Qe27Ubxj6Wkc\_4/edit?usp=sharing](https://docs.google.com/spreadsheets/d/1XYuuxtlPOgE2h5cwVePRG92urNVr_Qe27Ubxj6Wkc_4/edit?usp=sharing)

Thank you so much

---

<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:** [April 10, 2021, 11:00pm UTC](https://community.glideapps.com/t/how-to-keep-formula-while-adding-new-lines-to-database/25274/10 "2021-04-10T23:00:15Z")

</div>

I just requested access to your Sheet. My email is [ariesarsenal@gmail.com](mailto:ariesarsenal@gmail.com).

---

<div class="post-metadata">

**Author:** ![Keith\_Chikumbirike](https://avatars.discourse-cdn.com/v4/letter/k/5daacb/32.png) [@Keith\_Chikumbirike](https://community.glideapps.com/u/Keith_Chikumbirike)\
**Post date:** [April 11, 2021, 5:10pm UTC](https://community.glideapps.com/t/how-to-keep-formula-while-adding-new-lines-to-database/25274/11 "2021-04-11T17:10:01Z")

</div>

> [@ThinhDinh](#):
>
> [ariesarsenal@gmail.com](mailto:ariesarsenal@gmail.com).

Ook, i have just sent you with editing access

---

<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:** [April 11, 2021, 11:16pm UTC](https://community.glideapps.com/t/how-to-keep-formula-while-adding-new-lines-to-database/25274/12 "2021-04-11T23:16:39Z")

</div>

> [@Is it possible to do a row to column relation](https://community.glideapps.com/t/is-it-possible-to-do-a-row-to-column-relation/17389/):
>
> How can I relate rows to columns using similar Row IDs in different worksheets, Id like to do this because I have a sheet calculating lists but I won’t be able to view a specific inlist if it cannot relate to another string of data in a different sheet

If I’m correct, we did talk about the same thing here.

Your structure is weird. I believe a better way to do this is to have your rowIDs in the Panel list as one single column.

Let’s say:

Cabinet ID | Panel ID | Row ID | Quantity

Then in the second sheet have three columns

Row ID | Panel ID | Quantity

Then the quantity column can be derived using a rollup inside Glide on top of a relation, or an easier query inside the Sheet.

---

<div class="post-metadata">

**Author:** ![Keith\_Chikumbirike](https://avatars.discourse-cdn.com/v4/letter/k/5daacb/32.png) [@Keith\_Chikumbirike](https://community.glideapps.com/u/Keith_Chikumbirike)\
**Post date:** [April 13, 2021, 5:57pm UTC](https://community.glideapps.com/t/how-to-keep-formula-while-adding-new-lines-to-database/25274/13 "2021-04-13T17:57:42Z")

</div>

You’re correct, it’s the same file we talked about the other time…  
Im new to database structures but I have been using spreadsheets for a while now for basic data work.  
Im working on your advice…

---

<div class="post-metadata">

**Author:** ![Keith\_Chikumbirike](https://avatars.discourse-cdn.com/v4/letter/k/5daacb/32.png) [@Keith\_Chikumbirike](https://community.glideapps.com/u/Keith_Chikumbirike)\
**Post date:** [April 13, 2021, 7:51pm UTC](https://community.glideapps.com/t/how-to-keep-formula-while-adding-new-lines-to-database/25274/14 "2021-04-13T19:51:41Z")

</div>

> [@ThinhDinh](#):
>
> Cabinet ID | Panel ID | Row ID | Quantity

But it would help to explain to you where the Quantities of the panels in the suggested Cabinet ID | Panel ID | Row ID | Quantity sheet are coming from

Each project has many cabinets, each cabinet has many panels…this would mean the sheet you have suggested will be populated by so many panels, cabinets, and projects, etc.

so far in the existing structure, the number of panels per cabinet per project are calculated by an INDEXMATCH from the projects sheet which…

However, I’m going for your suggested restructuring…  
I hope I don’t consume to many rows and i figure it out lol

---

<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:** [April 13, 2021, 11:14pm UTC](https://community.glideapps.com/t/how-to-keep-formula-while-adding-new-lines-to-database/25274/15 "2021-04-13T23:14:02Z")

</div>

> [@Keith\_Chikumbirike](#):
>
> Each project has many cabinets, each cabinet has many panels…this would mean the sheet you have suggested will be populated by so many panels, cabinets, and projects, etc.

Yes, you’re understanding it right. It’s the only way to make the structure easier to be calculated either with an Arrayformula or a Glide flow. It will definitely consume more rows.

---

<div class="post-metadata">

**Author:** ![Keith\_Chikumbirike](https://avatars.discourse-cdn.com/v4/letter/k/5daacb/32.png) [@Keith\_Chikumbirike](https://community.glideapps.com/u/Keith_Chikumbirike)\
**Post date:** [April 16, 2021, 6:24pm UTC](https://community.glideapps.com/t/how-to-keep-formula-while-adding-new-lines-to-database/25274/16 "2021-04-16T18:24:18Z")

</div>

Ok… But the desired outcome at the end of the day is to count the unique panels per project when u open the projects details…

How will that happen if the roll up columns are on a separate sheet? 🤔

---

<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:** [April 16, 2021, 11:28pm UTC](https://community.glideapps.com/t/how-to-keep-formula-while-adding-new-lines-to-database/25274/17 "2021-04-16T23:28:35Z")

</div>

Are the “projects” ones with the “rowIDs”? If so, I assume you have a Project Sheet with those IDs, then you can use a relation pointing that column to the Project ID column in the Panels Sheet and show them as an inline list inside the Project details view.

---

<div class="post-metadata">

**Author:** ![Keith\_Chikumbirike](https://avatars.discourse-cdn.com/v4/letter/k/5daacb/32.png) [@Keith\_Chikumbirike](https://community.glideapps.com/u/Keith_Chikumbirike)\
**Post date:** [April 17, 2021, 3:07pm UTC](https://community.glideapps.com/t/how-to-keep-formula-while-adding-new-lines-to-database/25274/18 "2021-04-17T15:07:12Z")

</div>

Yes, there are rowIDs in the project sheet, but the cabinets are in the projects table as column headers. Since each project can have more than 1 of each cabinet type the user populates the columns with the number of the cabinets that particular project has…

So it becomes difficult to make a relation  
Meanwhile, the current structure is fully functional except for the arrayformula issue lol

I’m studying around the relations and learning more about them in the meantime

Non the less, do you have an example of your suggested structure I can study?

---

<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:** [April 17, 2021, 11:23pm UTC](https://community.glideapps.com/t/how-to-keep-formula-while-adding-new-lines-to-database/25274/19 "2021-04-17T23:23:02Z")

</div>

I think probably this would help.

[https://docs.glideapps.com/all/guides/deep-dives/design/subcategories](https://docs.glideapps.com/all/guides/deep-dives/design/subcategories)

Probably you won’t need to scale this up but generally I don’t think making column headers rowIDs from other Sheets is good practice.

Your formulas would work in the Sheet with the current structure you have, but I would recommend re-building the whole flow to have a clean database for an app in the long term.

---

<div class="post-metadata">

**Author:** ![Keith\_Chikumbirike](https://avatars.discourse-cdn.com/v4/letter/k/5daacb/32.png) [@Keith\_Chikumbirike](https://community.glideapps.com/u/Keith_Chikumbirike)\
**Post date:** [April 18, 2021, 9:32am UTC](https://community.glideapps.com/t/how-to-keep-formula-while-adding-new-lines-to-database/25274/20 "2021-04-18T09:32:23Z")

</div>

Thank you…

Going through…

[Next page](https://community.glideapps.com/t/how-to-keep-formula-while-adding-new-lines-to-database/25274.md?page=2)
