# If\_then\_else

**URL:** <https://community.glideapps.com/t/if-then-else/83169>\
**Category:** Ask for Help\
**Created:** [July 15, 2025, 7:12am UTC](https://community.glideapps.com/t/if-then-else/83169 "2025-07-15T07:12:48Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![Olivia\_Kern](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/olivia_kern/32/90348_2.png) [@Olivia\_Kern](https://community.glideapps.com/u/Olivia_Kern)\
**Post date:** [July 15, 2025, 7:12am UTC](https://community.glideapps.com/t/if-then-else/83169/1 "2025-07-15T07:12:49Z")

</div>

Hi there,

I’m building an app to manage a fleet of cars and I want to create an if\_then\_else condition that shows says if the trip is a round trip then display as round trip else show one way. The use case is that a driver can select a oneway trip or a round trip and if they choose a round trip then it needs to double the kms. However when I choose the if\_then\_else functionality the output doesn’t seem to calculate the value from the correct column and the value shows multiple digits instead of a whole number despite the fact that I set the precision to one in the column it’s receiving the data from.  
Please can you help identify what I’m doing wrong?

 ![Screenshot 2025-07-15 at 09.08.47](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/2/e/2eac29721478c5968692fc6edb2715a6032f1821.png)  
 ![Screenshot 2025-07-15 at 09.08.23](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/0/4/0473e4f7dc0a312c09bb4fdf76325c18b1ea4796.png)

---

<div class="post-metadata">

**Author:** ![Darbi\_Moore](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darbi_moore/32/83033_2.png) [@Darbi\_Moore](https://community.glideapps.com/u/Darbi_Moore)\
**Post date:** [July 15, 2025, 7:14am UTC](https://community.glideapps.com/t/if-then-else/83169/2 "2025-07-15T07:14:49Z")

</div>

Could you share a screenshot with the Trip Type coloumn as well?

---

<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:** [July 15, 2025, 7:38am UTC](https://community.glideapps.com/t/if-then-else/83169/3 "2025-07-15T07:38:10Z")

</div>

The problem is that you are trying to match the Trip Type column with the calculated round trip distance, and I assume they will never match, so your if-then-else column as it is will always return the one way distance.

You need to match the actual values in your Trip Type column in the first case of the if-then-else. So something like:

- If Trip Type is Round Trip (literal text), then “Calculated Round Trip Distance” (your math column)
- Else One Way Distance

---

<div class="post-metadata">

**Author:** ![Olivia\_Kern](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/olivia_kern/32/90348_2.png) [@Olivia\_Kern](https://community.glideapps.com/u/Olivia_Kern)\
**Post date:** [July 15, 2025, 7:45am UTC](https://community.glideapps.com/t/if-then-else/83169/4 "2025-07-15T07:45:42Z")

</div>

The first row doesn’t have a value because the if\_the\_else is was not configured

 ![Screenshot 2025-07-15 at 09.42.20](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/4/0/40a1eacc66363b7d51cc3ad20d3670877675feda.png)

---

<div class="post-metadata">

**Author:** ![Olivia\_Kern](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/olivia_kern/32/90348_2.png) [@Olivia\_Kern](https://community.glideapps.com/u/Olivia_Kern)\
**Post date:** [July 15, 2025, 7:48am UTC](https://community.glideapps.com/t/if-then-else/83169/5 "2025-07-15T07:48:11Z")

</div>

OK if I understand correctly I’m not supposed to choose a column but rather type the words Round Trip and the choose the math column. I’ll try this. Thank you.

---

<div class="post-metadata">

**Author:** ![Olivia\_Kern](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/olivia_kern/32/90348_2.png) [@Olivia\_Kern](https://community.glideapps.com/u/Olivia_Kern)\
**Post date:** [July 15, 2025, 8:03am UTC](https://community.glideapps.com/t/if-then-else/83169/7 "2025-07-15T08:03:51Z")

</div>

Thanks so much it worked, but it didn’t fix the decimal issue even though I’ve set the precision to 1, how can I fix that?

 ![Screenshot 2025-07-15 at 10.00.33](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/4/8/487818217f5b67c61e0a7f2a9da3bc238bca7c26.jpeg)  
 ![Screenshot 2025-07-15 at 10.02.59](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/8/8/881487dbcd16a5182e07e7167a8c30441675cb6e.png)

---

<div class="post-metadata">

**Author:** ![Darbi\_Moore](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darbi_moore/32/83033_2.png) [@Darbi\_Moore](https://community.glideapps.com/u/Darbi_Moore)\
**Post date:** [July 15, 2025, 9:17am UTC](https://community.glideapps.com/t/if-then-else/83169/8 "2025-07-15T09:17:29Z")

</div>

Idk if this would fully work, but maybe calculate the Distance without the KM units and then add them via a separate template column then try and use it in the math column. I just think the unit may be confusing it. (so have “One Way Distance” (distance coloumn) and then “One Way Distance + unit” (templete coloumn) and use the first distance coloum in the math equation)

---

<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:** [July 15, 2025, 9:52am UTC](https://community.glideapps.com/t/if-then-else/83169/9 "2025-07-15T09:52:18Z")

</div>

You need to modify your math formula, use the following:  
`Round(OneWayDistance * 2,1)`

---

<div class="post-metadata">

**Author:** ![Olivia\_Kern](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/olivia_kern/32/90348_2.png) [@Olivia\_Kern](https://community.glideapps.com/u/Olivia_Kern)\
**Post date:** [July 15, 2025, 11:18am UTC](https://community.glideapps.com/t/if-then-else/83169/10 "2025-07-15T11:18:52Z")

</div>

Thanks, the formula works for round trip but not single, unfortunately. Is there something else I need to add to it?

 ![Screenshot 2025-07-15 at 13.21.29](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/2/9/29326d502ebc868e44e8c481a56a9eb63d20c20f.png)

---

<div class="post-metadata">

**Author:** ![Olivia\_Kern](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/olivia_kern/32/90348_2.png) [@Olivia\_Kern](https://community.glideapps.com/u/Olivia_Kern)\
**Post date:** [July 15, 2025, 11:20am UTC](https://community.glideapps.com/t/if-then-else/83169/11 "2025-07-15T11:20:49Z")

</div>

It doesn’t allow me to add a distance column without adding a unit. It’s either miles or kms. Hope I understood it correctly.

---

<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:** [July 15, 2025, 11:45am UTC](https://community.glideapps.com/t/if-then-else/83169/12 "2025-07-15T11:45:48Z")

</div>

> [@Olivia\_Kern](#):
>
> Is there something else I need to add to it?

Create another math column with the same formula and point it at the One Way Distance column.

Alternatively, you could use a single math column that rounds the result of your if-then-else column. That would be one less column required.

---

<div class="post-metadata">

**Author:** ![Olivia\_Kern](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/olivia_kern/32/90348_2.png) [@Olivia\_Kern](https://community.glideapps.com/u/Olivia_Kern)\
**Post date:** [July 16, 2025, 6:46am UTC](https://community.glideapps.com/t/if-then-else/83169/13 "2025-07-16T06:46:35Z")

</div>

Hi there,

Thank you for your assistance so far. The AI assistant also proposed replacing the if-then-else column with a math column instead and gave me a configuration to enter but Glide does not accept the syntax. `OneWayDistance * 2` when Trip Type is Round Trip, otherwise `OneWayDistance`. I’m not a developer so I’m unsure what to enter, would it be possible for you to assist me please? These are what I’ve tried.

 ![Screenshot 2025-07-16 at 08.45.04](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/e/7/e77a0a85800ac284317c7b620250c13411c14450.png)  
 ![Screenshot 2025-07-16 at 08.44.41](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/0/b/0b71ab389e810dcaae49fd90f9a2d3f9351b1744.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:** [July 16, 2025, 7:11am UTC](https://community.glideapps.com/t/if-then-else/83169/14 "2025-07-16T07:11:43Z")

</div>

No, the math column doesn’t support conditional logic like that, so you need to keep the if-then-else column. My suggestion was to add another math column, and use that to round the result of the if-then-else column. So keep all the columns like below:

 ![CleanShot 2025-07-16 at 15.10.30@2x](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/2/4/24849fb1c566242da2277d726e09479b6f6c5b68.png)

Then add one more math column using the same formula that I gave you earlier, but use the output of the if-then-else column in the formula.

---

<div class="post-metadata">

**Author:** ![Olivia\_Kern](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/olivia_kern/32/90348_2.png) [@Olivia\_Kern](https://community.glideapps.com/u/Olivia_Kern)\
**Post date:** [July 16, 2025, 1:29pm UTC](https://community.glideapps.com/t/if-then-else/83169/15 "2025-07-16T13:29:27Z")

</div>

> [@Darren\_Murphy](#):
>
> Round(OneWayDistance \* 2,1)

Thank you, this worked. Appreciate all your help 🙏
