# Calculation in the If-Else statement

**URL:** <https://community.glideapps.com/t/calculation-in-the-if-else-statement/74289>\
**Category:** Ask for Help\
**Created:** [June 21, 2024, 5:38am UTC](https://community.glideapps.com/t/calculation-in-the-if-else-statement/74289 "2024-06-21T05:38:39Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ishita\_shah](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/ishita_shah/32/76809_2.png) [@ishita\_shah](https://community.glideapps.com/u/ishita_shah)\
**Post date:** [June 21, 2024, 5:38am UTC](https://community.glideapps.com/t/calculation-in-the-if-else-statement/74289/1 "2024-06-21T05:38:39Z")

</div>

I am creating an app to calculate my savings. I want to change the amount I am adding to Positive if the transaction type is Income and Negative if the type is Expense. How do create a column that multiplies the Amount by -1 if the transaction type is an Expense?

---

<div class="post-metadata">

**Author:** ![Pratik\_Shah](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/pratik_shah/32/12416_2.png) [@Pratik\_Shah](https://community.glideapps.com/u/Pratik_Shah)\
**Post date:** [June 21, 2024, 5:52am UTC](https://community.glideapps.com/t/calculation-in-the-if-else-statement/74289/2 "2024-06-21T05:52:07Z")

</div>

I would do it in a different way.

I will have two columns. Income Amount and Expense Amount. Another column to store your selection for “Income” or “Expense”.

Final column would be Math column which will add Income and subtract Expense.

In the form, you can show conditional field for Income and Expense.

Can you tell us more about how your app / data structure look like?

---

<div class="post-metadata">

**Author:** ![ishita\_shah](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/ishita_shah/32/76809_2.png) [@ishita\_shah](https://community.glideapps.com/u/ishita_shah)\
**Post date:** [June 21, 2024, 6:23am UTC](https://community.glideapps.com/t/calculation-in-the-if-else-statement/74289/3 "2024-06-21T06:23:11Z")

</div>

I already did that but there were too many columns so i was wondering if there was a cleaner way. Thank you anyway!

---

<div class="post-metadata">

**Author:** ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)\
**Post date:** [June 21, 2024, 12:49pm UTC](https://community.glideapps.com/t/calculation-in-the-if-else-statement/74289/4 "2024-06-21T12:49:39Z")

</div>

You could create a math column that multiplies the amount by -1 so you have both a positive and negative amount. Then have your IF column return either the positive or negative amount.

---

<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:** [June 28, 2024, 12:50pm UTC](https://community.glideapps.com/t/calculation-in-the-if-else-statement/74289/5 "2024-06-28T12:50:15Z")

</div>

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