# How to calculate using values from other row

**URL:** <https://community.glideapps.com/t/how-to-calculate-using-values-from-other-row/67654>\
**Category:** Ask for Help\
**Created:** [November 10, 2023, 1:59am UTC](https://community.glideapps.com/t/how-to-calculate-using-values-from-other-row/67654 "2023-11-10T01:59:54Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yoshi](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/yoshi/32/66260_2.png) [@Yoshi](https://community.glideapps.com/u/Yoshi)\
**Post date:** [November 10, 2023, 1:59am UTC](https://community.glideapps.com/t/how-to-calculate-using-values-from-other-row/67654/1 "2023-11-10T01:59:54Z")

</div>

Hello everyone,  
Currently, I am working on creating a fuel consumption management app.  
The data is a Google Spreadsheet with the following table structure:

- Date and Time
- Model Name
- Value of ODOMETER
- Amount of Fuel Refueled

Using this table, I aim to:

1. Calculate the distance traveled from the last refueling to the current refueling.
2. Compute fuel efficiency by dividing the distance traveled by the amount of fuel refueled.

While I have successfully retrieved the distance traveled at the last refueling using the Query column, I encountered difficulties using that value in the Math column for further calculations.

Could someone guide me on how to achieve these calculations? I appreciate any assistance or insights you can provide.

Thank you in advance!

---

<div class="post-metadata">

**Author:** ![tuzin](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/tuzin/32/86077_2.png) [@tuzin](https://community.glideapps.com/u/tuzin)\
**Post date:** [November 10, 2023, 12:28pm UTC](https://community.glideapps.com/t/how-to-calculate-using-values-from-other-row/67654/2 "2023-11-10T12:28:43Z")

</div>

If you’re using a lookup to retrieve the value from the Query, try using single value. Lookups from Queries always return arrays which can’t be used in Math

---

<div class="post-metadata">

**Author:** ![Yoshi](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/yoshi/32/66260_2.png) [@Yoshi](https://community.glideapps.com/u/Yoshi)\
**Post date:** [November 10, 2023, 12:52pm UTC](https://community.glideapps.com/t/how-to-calculate-using-values-from-other-row/67654/3 "2023-11-10T12:52:36Z")

</div>

I wanted to express my sincere gratitude for the prompt and helpful responses to my recent inquiry. With your guidance, I was able to successfully implement the calculations.  
Thank you !

---

<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:** [November 17, 2023, 12:53pm UTC](https://community.glideapps.com/t/how-to-calculate-using-values-from-other-row/67654/4 "2023-11-17T12:53:33Z")

</div>

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