# Math Operation

**URL:** <https://community.glideapps.com/t/math-operation/58151>\
**Category:** Ask for Help\
**Created:** [February 19, 2023, 9:15am UTC](https://community.glideapps.com/t/math-operation/58151 "2023-02-19T09:15:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Adviuz](https://avatars.discourse-cdn.com/v4/letter/a/b38774/32.png) [@Adviuz](https://community.glideapps.com/u/Adviuz)\
**Post date:** [February 19, 2023, 9:15am UTC](https://community.glideapps.com/t/math-operation/58151/1 "2023-02-19T09:15:03Z")

</div>

Dear Team.

I want to calculate Available Balance from below table, please guide.

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/6/1/616e4f44b05b682cdeab1d9d0adf71879d51b603.png)

---

<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:** [February 19, 2023, 9:29am UTC](https://community.glideapps.com/t/math-operation/58151/2 "2023-02-19T09:29:20Z")

</div>

I would probably structure it differently, but given the way you have presented it, you could do the following:

- Create an if-then-else column (ifDebit):  
– If DebitCredit is DR, then Amount  
– If DebitCredit is Dr, then Amount
- Create another if-then-else column (ifCredit)  
– If DebitCredit is CR, then Amount
- Create a Rollup column that takes a sum of the ifDebit column. This will be the Total Debit
- Create a Rollup column that takes a sum of the ifCredit column. This will be the Total Credit.
- Create a Math column to calculate the Available Balance. The formula should be: `Total Credit - Total Debit`
