# math formula

**URL:** <https://community.glideapps.com/t/math-formula/22807>\
**Category:** Ask for Help\
**Created:** [February 15, 2021, 11:36am UTC](https://community.glideapps.com/t/math-formula/22807 "2021-02-15T11:36:03Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Izhar](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/izhar/32/21308_2.png) [@Izhar](https://community.glideapps.com/u/Izhar)\
**Post date:** [February 15, 2021, 11:36am UTC](https://community.glideapps.com/t/math-formula/22807/1 "2021-02-15T11:36:04Z")

</div>

i just newly using glide and try to make ledger app. very basic app.  
how to make all row auto calculate base on math formula. below my screen shoot.  
debit-credit=bal. then last result in balance will do operation minus or plus in next row. that how it goes until end of row.

![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/7/d/7d8aec05f7aa94dcaac20210026ea78d03f45427.png)

---

<div class="post-metadata">

**Author:** ![SantiagoPerez](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/santiagoperez/32/16807_2.png) [@SantiagoPerez](https://community.glideapps.com/u/SantiagoPerez)\
**Post date:** [February 15, 2021, 12:35pm UTC](https://community.glideapps.com/t/math-formula/22807/2 "2021-02-15T12:35:37Z")

</div>

Hola @Izhar,

If I understand correctly, you want to add/subtract the result of both columns, right?

If so, the way I would do it is to use a rollup column for the debit and a rollup column for the credit. Then that’s what I’d have in the math column.

---

<div class="post-metadata">

**Author:** ![Izhar](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/izhar/32/21308_2.png) [@Izhar](https://community.glideapps.com/u/Izhar)\
**Post date:** [February 16, 2021, 4:20pm UTC](https://community.glideapps.com/t/math-formula/22807/3 "2021-02-16T16:20:59Z")

</div>

Hi Santiago,

Thank you for your opinion. I believe that what i want to do. to be more specific if user insert in debit or credit the result will be in balance. I used to do at spreadsheet using formula but it was manual. below is formula in spreadsheet.

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/9/9/993937a1e5b50e095229dada762cabb2101bde11.png)

---

<div class="post-metadata">

**Author:** ![profechef](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/profechef/32/221_2.png) [@profechef](https://community.glideapps.com/u/profechef)\
**Post date:** [February 16, 2021, 5:48pm UTC](https://community.glideapps.com/t/math-formula/22807/4 "2021-02-16T17:48:56Z")

</div>

I’ve tried to implement a math formula which adds the current value plus the previous total through a relation, but there seems to be a bug and the math column doesn’t add the previous value

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/5/d/5d63923d54d4c0449da856f5b84859d9c492c62b.png)

---

<div class="post-metadata">

**Author:** ![Izhar](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/izhar/32/21308_2.png) [@Izhar](https://community.glideapps.com/u/Izhar)\
**Post date:** [February 17, 2021, 2:33am UTC](https://community.glideapps.com/t/math-formula/22807/5 "2021-02-17T02:33:39Z")

</div>

yeah that was my problem too but it worked on spreadsheet.  
i am still doing manual at spreadsheet for balance column so it  
kind of half automation.

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/7/c/7c07d9c4d589713d43128cb7cfb33662ea37684e.png)

---

<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:** [February 17, 2021, 3:15am UTC](https://community.glideapps.com/t/math-formula/22807/6 "2021-02-17T03:15:45Z")

</div>

Hi Izhar,

I faced the same the problem before.  
I just using google sheet to do math. Because Glide can read the google sheet. Hmmm

---

<div class="post-metadata">

**Author:** ![profechef](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/profechef/32/221_2.png) [@profechef](https://community.glideapps.com/u/profechef)\
**Post date:** [February 18, 2021, 1:37pm UTC](https://community.glideapps.com/t/math-formula/22807/7 "2021-02-18T13:37:15Z")

</div>

I’ve solved it with a little help of @gvalero  
 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/8/3/837cd43b5876319bdabe0457bb8f29370ae9f3d2.png)  
 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/8/e/8e98aabd1c984de62078f934fc342ea65833f820.png)  
 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/9/c/9cc7ed7e97d158465e07c29474fb0e2c21bb461b.png)  
I’ve made a relation with the previous item and then I add the current value with the previous total. @gvalero solved the issue with the sum in the total colum multipliying the lookup column \*1

---

<div class="post-metadata">

**Author:** ![Izhar](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/izhar/32/21308_2.png) [@Izhar](https://community.glideapps.com/u/Izhar)\
**Post date:** [February 19, 2021, 2:07am UTC](https://community.glideapps.com/t/math-formula/22807/8 "2021-02-19T02:07:36Z")

</div>

if you can elaborate a little bit? meaning i have to create new spreadsheet and do lookup or vlookup?

---

<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:** [February 19, 2021, 2:33am UTC](https://community.glideapps.com/t/math-formula/22807/9 "2021-02-19T02:33:31Z")

</div>

No, you can do it inside Glide using a relation - lookup - math column.

---

<div class="post-metadata">

**Author:** ![profechef](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/profechef/32/221_2.png) [@profechef](https://community.glideapps.com/u/profechef)\
**Post date:** [February 19, 2021, 4:52pm UTC](https://community.glideapps.com/t/math-formula/22807/10 "2021-02-19T16:52:24Z")

</div>

There are no calcs in google sheet. All columns are in Glide.

1. A relation (“rel anterior”) associates each item with previous item
2. A lookup column (“sum ant”), inside Glide, gets the value of the previous total sum (“sum”) using that relation
3. A math formula , inside Glide, adds current item value with lookup column value in “sum” column. You can see the detail of this formula in the third picture.

---

<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:48am UTC](https://community.glideapps.com/t/math-formula/22807/11 "2021-03-08T01:48:56Z")

</div>

Hi Izhar,

Did you solved this issue?  
If yes, share boleh tak?

---

<div class="post-metadata">

**Author:** ![Izhar](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/izhar/32/21308_2.png) [@Izhar](https://community.glideapps.com/u/Izhar)\
**Post date:** [March 10, 2021, 4:20pm UTC](https://community.glideapps.com/t/math-formula/22807/12 "2021-03-10T16:20:40Z")

</div>

Biha,  
kau bantai ckp melayu ye 😀  
belum lagi. you can try first and share result with us.

---

<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 11, 2021, 12:44am UTC](https://community.glideapps.com/t/math-formula/22807/13 "2021-03-11T00:44:31Z")

</div>

This way possible tak?

![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/3/4/347f52fef2adc3c7565ac67dd46a4b13b3969a05.png)

Add column math tu yang “Debit - Credit”  
And Roll up of “Debit - Credit” with sum  
But it showing the last balance.
