# Calculating delta between 2 rows

This is something that’s very simple in Excel or Google Sheets (which I am trying to migrate from) but I was not able to Google an obvious solution for Coda.

• Each week is represented by a row.
• I have a column with a certain metric (hours) that changes from week to week.
• I have another column that tracks a WoW delta for that metric (20 hour drop = -20, 5 hour increase = +5 etc)

How can this be accomplished with a formula, so that each cell runs basic math and subtracts value of the cell below from its own value?

@drungarius

I use the below concept of “visual position” heavily. There is some debate among the engineers whether it is stable, and how to best address this challenge in the long term. There are one or two mega threads about this somewhere in the forum – find them and read them if you want to understand the nuances involved. However, for now, this works. I’ve never had a problem with it, and it’s ubiquitous throughout my projects.

Once you establish the visual position of the rows, you can key off that to accomplish most spreadsheet type jobs that depend on sequential rows.

Review the formulas in the blue columns. Note the value for the first row is hard coded in the formula.

I’ve used this for so long that I forgot who I got it from, but I think it was @Krunal_Sheth.

Consider this just one example of many sequential jobs you can do:

3 Likes