# Doing math on multiple columns

**URL:** <https://community.glideapps.com/t/doing-math-on-multiple-columns/76402>\
**Category:** Ask for Help\
**Created:** [September 16, 2024, 1:10am UTC](https://community.glideapps.com/t/doing-math-on-multiple-columns/76402 "2024-09-16T01:10:23Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![carlos\_villegas](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/carlos_villegas/32/79714_2.png) [@carlos\_villegas](https://community.glideapps.com/u/carlos_villegas)\
**Post date:** [September 16, 2024, 1:10am UTC](https://community.glideapps.com/t/doing-math-on-multiple-columns/76402/1 "2024-09-16T01:10:23Z")

</div>

I have several columns that take in minutes and converts them to hours:minutes format. Now about 4-6 columns are formatted data using the math `FLOOR(T/60)` for the hour and `MOD(T,60)` for the minutes. Here’s what I want to do I want to be able to replace T with the 4-6 columns take in minutes as input without having to create a separate math column for each one is there a shortcut around this?

If you need me to explain more let me know

---

<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:** [September 16, 2024, 1:24am UTC](https://community.glideapps.com/t/doing-math-on-multiple-columns/76402/2 "2024-09-16T01:24:11Z")

</div>

So you have 4-6 columns in minutes format and want to convert them to hours:minutes format without having to create 3 extra columns for each of them?

---

<div class="post-metadata">

**Author:** ![carlos\_villegas](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/carlos_villegas/32/79714_2.png) [@carlos\_villegas](https://community.glideapps.com/u/carlos_villegas)\
**Post date:** [September 16, 2024, 1:29am UTC](https://community.glideapps.com/t/doing-math-on-multiple-columns/76402/4 "2024-09-16T01:29:34Z")

</div>

Yes that is correct is there a shortcut around this?

---

<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:** [September 16, 2024, 1:30am UTC](https://community.glideapps.com/t/doing-math-on-multiple-columns/76402/5 "2024-09-16T01:30:24Z")

</div>

First option for you: record them in seconds instead of minutes and use this.

![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/4/8/481fb0373f1135af032ec0f440b7fefd67340844.png)

Second option: use JavaScript.

```auto
const hours = Math.floor(p1 / 60);
const mins = p1 % 60;

return `${hours.toString().padStart(2, '0')}:${mins.toString().padStart(2, '0')}`;

```

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/c/0/c0c29896c74cc8894d4058125fe4ab905219d7ec.png)

---

<div class="post-metadata">

**Author:** ![carlos\_villegas](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/carlos_villegas/32/79714_2.png) [@carlos\_villegas](https://community.glideapps.com/u/carlos_villegas)\
**Post date:** [September 16, 2024, 1:41am UTC](https://community.glideapps.com/t/doing-math-on-multiple-columns/76402/6 "2024-09-16T01:41:45Z")

</div>

Thank you so much this just saved me the hassle I didn’t even know you could use JS

---

<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:** [September 23, 2024, 1:42am UTC](https://community.glideapps.com/t/doing-math-on-multiple-columns/76402/7 "2024-09-23T01:42:44Z")

</div>

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