Read from row above

Hi Gliders, I made a petrol usage app. It’s pretty cool, but you always have to enter the old and the new km in order to calculate how far you have driven to then calculate the usage per 100km. I have search for a long time now but I can’t find a way to get the value of another column in the row above the current row. Is there a way? Cheers, steffen

I imagine you can have a setup like this:

  • In Sheets: a numerical order column that returns the record number of your petrol usage submission.

    =ARRAYFORMULA(IF(A2:A<>"",ROW(A2:A)-1,""))

  • In Editor: a math column to return the “row above number”. Current row number - 1. Then a relation from the math column to the numerical order column. From that, you can return the columns you want using lookup.

1 Like

Wow, that is pretty bloody fantastic mate! I got it!! Thanks so much. I need to do more with Glide, it’s so cool!

2 Likes

Let us know if we can help more mate. Have a nice week!

1 Like

Also, if you’re not familiar with arrayformula, I wrote a post here :smile:

Tutorial: Arrayformula in Google Sheets, good practices & how to overcome Arrayformula restrictions with scripts