# How do I do this math without Google Sheets?

**URL:** <https://community.glideapps.com/t/how-do-i-do-this-math-without-google-sheets/56489>\
**Category:** Ask for Help\
**Created:** [January 9, 2023, 2:08pm UTC](https://community.glideapps.com/t/how-do-i-do-this-math-without-google-sheets/56489 "2023-01-09T14:08:21Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![erwblo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/erwblo/32/75_2.png) [@erwblo](https://community.glideapps.com/u/erwblo)\
**Post date:** [January 9, 2023, 2:08pm UTC](https://community.glideapps.com/t/how-do-i-do-this-math-without-google-sheets/56489/1 "2023-01-09T14:08:21Z")

</div>

> I want to build an app with Glide where I can do the following. I add rows where I have a column with the day and a column with an amount of hours. After that the users can add up the hours between two dates bij selecting a start and an end time. How do I do this?

This is the answer of ChatGPT but I want to do it in Glide Tables only 😉 How to do it? Or do you have example apps?

 ![CleanShot 2023-01-09 at 15.04.28@2x](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/5/5/555efc1462224dd9c753310f70a2088a4f56c646.jpeg)

---

<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:** [January 9, 2023, 2:15pm UTC](https://community.glideapps.com/t/how-do-i-do-this-math-without-google-sheets/56489/2 "2023-01-09T14:15:11Z")

</div>

Let’s assume you write the user selected Start Date and End Date to two user specific columns.

- Start by adding two single value columns to your table that contains the data: one for the start date and one for the end date. This will apply those dates to every row in the table.
- Now add an if-then-else column:  
– If date is before single value start date, then null (leave empty)  
– If date is after single value end date, then null  
– Else amount of hours
- Now do a rollup-\>sum on the if-then-else column to get the total number of hours between the two dates.

---

<div class="post-metadata">

**Author:** ![erwblo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/erwblo/32/75_2.png) [@erwblo](https://community.glideapps.com/u/erwblo)\
**Post date:** [January 9, 2023, 2:16pm UTC](https://community.glideapps.com/t/how-do-i-do-this-math-without-google-sheets/56489/3 "2023-01-09T14:16:43Z")

</div>

Thanks, I’m going to try that!

---

<div class="post-metadata">

**Author:** ![erwblo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/erwblo/32/75_2.png) [@erwblo](https://community.glideapps.com/u/erwblo)\
**Post date:** [January 9, 2023, 2:22pm UTC](https://community.glideapps.com/t/how-do-i-do-this-math-without-google-sheets/56489/4 "2023-01-09T14:22:58Z")

</div>

Sorry @Darren_Murphy extra question.  
Say if I want the admin to be able to this too, I need another solution, right?

---

<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:** [January 9, 2023, 2:25pm UTC](https://community.glideapps.com/t/how-do-i-do-this-math-without-google-sheets/56489/5 "2023-01-09T14:25:14Z")

</div>

No, that’s a general solution that should work for any user.

Did you need the result to be filtered by the current (signed in) user? (you didn’t say that you did)

---

<div class="post-metadata">

**Author:** ![erwblo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/erwblo/32/75_2.png) [@erwblo](https://community.glideapps.com/u/erwblo)\
**Post date:** [January 9, 2023, 2:26pm UTC](https://community.glideapps.com/t/how-do-i-do-this-math-without-google-sheets/56489/6 "2023-01-09T14:26:41Z")

</div>

I didn’t say it and I didn’t mean it 😉 !

---

<div class="post-metadata">

**Author:** ![erwblo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/erwblo/32/75_2.png) [@erwblo](https://community.glideapps.com/u/erwblo)\
**Post date:** [January 9, 2023, 7:40pm UTC](https://community.glideapps.com/t/how-do-i-do-this-math-without-google-sheets/56489/7 "2023-01-09T19:40:19Z")

</div>

Sorry to ask stupid questions, but where do i get the data for the two single-value columns (start date and end date)? I never really understand this concept. Well I sometimes do, but not here.

---

<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 9, 2023, 7:51pm UTC](https://community.glideapps.com/t/how-do-i-do-this-math-without-google-sheets/56489/8 "2023-01-09T19:51:58Z")

</div>

Whichever table/row you write those start and end dates to would be the table/row where to point the single value columns. I assume you would have date pickers somewhere in your app, and those date pickers write to a certain table/row. That’s where you want the single value columns to retrieve those values. Then the single value columns will populate the same value on every row.

---

<div class="post-metadata">

**Author:** ![erwblo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/erwblo/32/75_2.png) [@erwblo](https://community.glideapps.com/u/erwblo)\
**Post date:** [January 9, 2023, 7:53pm UTC](https://community.glideapps.com/t/how-do-i-do-this-math-without-google-sheets/56489/9 "2023-01-09T19:53:38Z")

</div>

Ah so I have a column StartDateRow and a column SingleValueStartDateRow for example?

---

<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 9, 2023, 8:03pm UTC](https://community.glideapps.com/t/how-do-i-do-this-math-without-google-sheets/56489/10 "2023-01-09T20:03:10Z")

</div>

Yes, exactly. Assuming you have a date picker that populates a start date in the first row of a table, then you can use the single value column to take that value from the first row and populate it across all rows.

---

<div class="post-metadata">

**Author:** ![erwblo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/erwblo/32/75_2.png) [@erwblo](https://community.glideapps.com/u/erwblo)\
**Post date:** [January 9, 2023, 8:11pm UTC](https://community.glideapps.com/t/how-do-i-do-this-math-without-google-sheets/56489/11 "2023-01-09T20:11:07Z")

</div>

The idea is this, I have different people / companies adding hours / money they put in a big project.  
I want to be able to calculate the amount of hours / money in a period per company.  
I want to be able to choose that period by picking start and end date. And then do the calculation.  
So I have a growing table with rows with work / money done by people for different companies.

Then it doesn’t feel like I can use the first row, am I right?

---

<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 9, 2023, 8:24pm UTC](https://community.glideapps.com/t/how-do-i-do-this-math-without-google-sheets/56489/12 "2023-01-09T20:24:13Z")

</div>

You can use any table you want. You could have a single row table that serves as the driver for your screen or tab. In the table you could have 2 user specific columns to hold the start and end dates, as well as a rollup column to sum hours from an IF column in the project table. In the project table, you would have 2 single value columns and an IF column as @Darren_Murphy described above.

You can also use the same table if you choose. There are lots of ways to get the same result.

---

<div class="post-metadata">

**Author:** ![erwblo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/erwblo/32/75_2.png) [@erwblo](https://community.glideapps.com/u/erwblo)\
**Post date:** [January 9, 2023, 8:25pm UTC](https://community.glideapps.com/t/how-do-i-do-this-math-without-google-sheets/56489/13 "2023-01-09T20:25:03Z")

</div>

Then to me a StartEndTable feels most logic!

---

<div class="post-metadata">

**Author:** ![erwblo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/erwblo/32/75_2.png) [@erwblo](https://community.glideapps.com/u/erwblo)\
**Post date:** [January 9, 2023, 9:02pm UTC](https://community.glideapps.com/t/how-do-i-do-this-math-without-google-sheets/56489/14 "2023-01-09T21:02:49Z")

</div>

@Jeff_Hager @Darren_Murphy I’ve got it up and running the way I want it and I understand what I’m doing! Thanks do much!
