# If Then Else - Calculate on the "Then"

**URL:** <https://community.glideapps.com/t/if-then-else-calculate-on-the-then/9867>\
**Category:** Ask for Help\
**Created:** [May 27, 2020, 12:33pm UTC](https://community.glideapps.com/t/if-then-else-calculate-on-the-then/9867 "2020-05-27T12:33:36Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mike\_Greene](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/mike_greene/32/5942_2.png) [@Mike\_Greene](https://community.glideapps.com/u/Mike_Greene)\
**Post date:** [May 27, 2020, 12:33pm UTC](https://community.glideapps.com/t/if-then-else-calculate-on-the-then/9867/1 "2020-05-27T12:33:36Z")

</div>

Hi I need to be able to calculate within the “THEN” part of the statement

 ![Screenshot 2020-05-27 at 14.19.55](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/2X/8/8a71e6f398191bfc6cf496b5343734e3e2c03252.png)  
But all I can enter for the THEN section is a column title OR a math statement - not both  
 ![Screenshot 2020-05-27 at 14.18.48](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/2X/2/2d849476c897da711c1b2326cdebffd76923f074.png)  
Is there any way I can use a column plus a math statement ?

---

<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:** [May 27, 2020, 12:46pm UTC](https://community.glideapps.com/t/if-then-else-calculate-on-the-then/9867/2 "2020-05-27T12:46:25Z")

</div>

Add a math column in your Glide data, calculate the (Working Fee/2)\*(.05) for all cases. Let’s say it’s named “Fee”.

Then add an If \> Then \> Else stating:

- If At full bareme? is True then Fee (assign the column).
- Else 0.

---

<div class="post-metadata">

**Author:** ![Mike\_Greene](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/mike_greene/32/5942_2.png) [@Mike\_Greene](https://community.glideapps.com/u/Mike_Greene)\
**Post date:** [May 27, 2020, 12:50pm UTC](https://community.glideapps.com/t/if-then-else-calculate-on-the-then/9867/3 "2020-05-27T12:50:20Z")

</div>

Thank you for the work arround - Strange that the THEN part of the statement can’t include a calculation !  
Mike

---

<div class="post-metadata">

**Author:** ![Mike\_Greene](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/mike_greene/32/5942_2.png) [@Mike\_Greene](https://community.glideapps.com/u/Mike_Greene)\
**Post date:** [May 27, 2020, 3:06pm UTC](https://community.glideapps.com/t/if-then-else-calculate-on-the-then/9867/4 "2020-05-27T15:06:28Z")

</div>

Thanks - that worked just fine -  
and thanks to the Glide team - App No.2 now finished - loving it !

---

<div class="post-metadata">

**Author:** ![david](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/david/32/62831_2.png) [@david](https://community.glideapps.com/u/david)\
**Post date:** [May 27, 2020, 3:17pm UTC](https://community.glideapps.com/t/if-then-else-calculate-on-the-then/9867/5 "2020-05-27T15:17:45Z")

</div>

@Mike_Greene great suggestion! It makes total sense that glide should work the way you originally tried.

---

<div class="post-metadata">

**Author:** ![gvalero](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/gvalero/32/1037_2.png) [@gvalero](https://community.glideapps.com/u/gvalero)\
**Post date:** [May 27, 2020, 3:22pm UTC](https://community.glideapps.com/t/if-then-else-calculate-on-the-then/9867/6 "2020-05-27T15:22:52Z")

</div>

I know what you feel @Mike_Greene

I have been waiting something like this too:  
 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/2X/b/b1f4251576a7f00c4dd43af3d271ac40fa0643eb.png)

In this way, we could write values to any field directly and have some kind of logic within Data Editor and make it more powerful. My example will be the easiest way to create a reset button and clear other fields/values directly.

Saludos

---

<div class="post-metadata">

**Author:** ![RobertM](https://avatars.discourse-cdn.com/v4/letter/r/ea5d25/32.png) [@RobertM](https://community.glideapps.com/u/RobertM)\
**Post date:** [January 11, 2025, 5:48pm UTC](https://community.glideapps.com/t/if-then-else-calculate-on-the-then/9867/7 "2025-01-11T17:48:56Z")

</div>

Reviving a very old thread here as I came across the same problem.

Basically I want to create the following…  
If Field A is 1  
then number of Days(Field B) \* 100  
If Field A is 2  
then number of Days(Field C) \* 100  
etc.

Was this implemented in Glide? I can’t seem to get it to work.

Cheers  
Rob

---

<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:** [January 11, 2025, 7:27pm UTC](https://community.glideapps.com/t/if-then-else-calculate-on-the-then/9867/8 "2025-01-11T19:27:27Z")

</div>

No. You can’t do calculations within an IF column. Your options are:

- Use a Javascript column to handle the IF condition and the math
- Create two math columns and then use an IF to pick which result you want.

---

<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:** [January 12, 2025, 1:38am UTC](https://community.glideapps.com/t/if-then-else-calculate-on-the-then/9867/9 "2025-01-12T01:38:37Z")

</div>

Here’s a math alternative:

`100 * (B * (2 - A) + C * (A - 1))`

When A = 1, the formula simplifies to:

`100 * (B * (2 - 1) + C * (1 - 1)) = 100 * (B * 1 + C * 0) = 100 * B`

When A = 2, the formula simplifies to:

`100 * (B * (2 - 2) + C * (2 - 1)) = 100 * (B * 0 + C * 1) = 100 * C`

 ![CleanShot 2025-01-12 at 08.38.20@2x](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/c/f/cfaf9c4c8028759841b48e215db80677612ef246.png)

I know you said number of days, but the formula can give you a head start.
