# Math Column and Logic Calculations

**URL:** <https://community.glideapps.com/t/math-column-and-logic-calculations/11294>\
**Category:** Ask for Help\
**Created:** [June 23, 2020, 12:15am UTC](https://community.glideapps.com/t/math-column-and-logic-calculations/11294 "2020-06-23T00:15:06Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Benedicta](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/benedicta/32/1772_2.png) [@Benedicta](https://community.glideapps.com/u/Benedicta)\
**Post date:** [June 23, 2020, 12:15am UTC](https://community.glideapps.com/t/math-column-and-logic-calculations/11294/1 "2020-06-23T00:15:06Z")

</div>

I have a formula working perfectly in the Google Sheet but because of the delay in calculations I need to use the Math Column, however I can’t for the life of me get it to work as calculations in Glide.

I want a user to select an option from 3, for this I’m using the choice component. Based on the response I want a value selected that is then added to another number.

In the Google Sheet I am using IFS to iterate through the choices and present the right number to add.

I have tried using If Then Else and Math but the choice component stops working. Help please!

---

<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:** [June 23, 2020, 12:30am UTC](https://community.glideapps.com/t/math-column-and-logic-calculations/11294/2 "2020-06-23T00:30:18Z")

</div>

Have a single relation - lookup matching that “option” you let users choose to take back the value you want to do the calculation, then create a math column and add that number to the “another number” you want. Would that work for you?

Or if you don’t care about storing that “option” you can let users choose that option at the front end, but at the back end store directly the value you want to do calculation with.

---

<div class="post-metadata">

**Author:** ![Benedicta](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/benedicta/32/1772_2.png) [@Benedicta](https://community.glideapps.com/u/Benedicta)\
**Post date:** [June 23, 2020, 12:34am UTC](https://community.glideapps.com/t/math-column-and-logic-calculations/11294/3 "2020-06-23T00:34:59Z")

</div>

Thanks @ThinhDinh there are different values for the 3 options for many of the line items. So I’m not sure I follow. I’m also yet to implement relations correctly and have an open question because what I’ve done on a many to one relation doesn’t seem to have worked.

---

<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:** [June 23, 2020, 12:52am UTC](https://community.glideapps.com/t/math-column-and-logic-calculations/11294/4 "2020-06-23T00:52:00Z")

</div>

Can I see some screenshots about your current settings for relations and what are the options & values for the choice component? Thank you.

---

<div class="post-metadata">

**Author:** ![Benedicta](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/benedicta/32/1772_2.png) [@Benedicta](https://community.glideapps.com/u/Benedicta)\
**Post date:** [June 23, 2020, 1:02am UTC](https://community.glideapps.com/t/math-column-and-logic-calculations/11294/5 "2020-06-23T01:02:51Z")

</div>

I haven’t done relations for this. I’ve got them to work now for the instance I was referring to with Lucas’s help.

So Choice component will have different costs for different products. Not sure if this shows what you are asking? ![Screenshot 2020-06-23 at 02.00.39](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/2X/7/70320e5de08db13f890f2fd927f7f6e0e8c25c92.png)

---

<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:** [June 23, 2020, 1:06am UTC](https://community.glideapps.com/t/math-column-and-logic-calculations/11294/6 "2020-06-23T01:06:44Z")

</div>

So what I imagine would be:

- Show the shipping option as countries (UK/Europe/International)
- In the backend instead of writing the countries’ name, write the shipping fee to the column you’re using to store that choice component.
- Have a math column to add the product price + shipping fee.

Is that what you want?

---

<div class="post-metadata">

**Author:** ![Benedicta](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/benedicta/32/1772_2.png) [@Benedicta](https://community.glideapps.com/u/Benedicta)\
**Post date:** [June 23, 2020, 1:11am UTC](https://community.glideapps.com/t/math-column-and-logic-calculations/11294/7 "2020-06-23T01:11:46Z")

</div>

That makes sense let me try it so your 1st statement: \* Show the shipping option as countries (UK/Europe/International), I should leave the front end as-is?

Second part: write the shipping fee to the column you’re using to store that choice component.  
Each product has it’s own price so I’m not sure I follow this one. This is the current choice component screenshot.

Third part- Math column is ok I have that but need the above to work first. ![Screenshot 2020-06-23 at 02.16.55](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/2X/5/5a1fe0ee965d7938034651d95b025ec2e2b46534.png)

---

<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:** [June 23, 2020, 1:41am UTC](https://community.glideapps.com/t/math-column-and-logic-calculations/11294/8 "2020-06-23T01:41:43Z")

</div>

Yeah you should leave the front end as it is. What are you trying to take back from a “UK” choice, is that a shipping fee that is fixed or it varies based on the product?

If it varies then you must do a relation.

---

<div class="post-metadata">

**Author:** ![Benedicta](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/benedicta/32/1772_2.png) [@Benedicta](https://community.glideapps.com/u/Benedicta)\
**Post date:** [June 23, 2020, 1:46am UTC](https://community.glideapps.com/t/math-column-and-logic-calculations/11294/9 "2020-06-23T01:46:40Z")

</div>

The shipping fee for the 3 different locations will vary depending on product. From the UK choice I’m getting the shipping fee.

Struggling to visualise the relation. So I would have a sheet with items each item with 3 different shipping fees and then the current choice table and do a relation? Not sure that works and how the choice component would facilitate the user selection.

---

<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:** [June 23, 2020, 1:59am UTC](https://community.glideapps.com/t/math-column-and-logic-calculations/11294/10 "2020-06-23T01:59:19Z")

</div>

Yeah I envision it to be a bit tricky for this case as the shipping fee varies.

To make it work it will probably cost a lot of rows but you can have a template column joining the product code/name with the shipping option in a sheet called “Fee Lookup”, then do a relation matching the product code/name and shipping choice from the user to that sheet, take back the corresponding fee.
