Google-sheets – How do subtract value in two consecutive rows and print it in a column

google sheets

I have a situation that needs to be handled. I have values in a column that are values of that particular instance in time I need the difference between each instant.

Input and output will be something like this

12760  12760 (Subtract with 0) 
15464  2704 (15464 - 12760)
17162  1698
19808  2646
22757  2949
25450  2693

How would I achieve this with SpreadSheet? Is it even possible?

Best Answer

It's not entirely clear what you're after, but I think I have the idea.

You have this data:

   |   A    |   B
----------------------------------------------------
 1 | 12760 
 2 | 15464
 3 | 17162
 4 | 19808
 5 | 22757
 6 | 25450

And you want column B to show the difference between the value in column A and the value in column A in the row above. That's really quite simple.

In B2 put the formula:

=A2-A1

Then you can autofill that down the rest of column B as far as you need.

For the first row, since there's an implied zero, just put in B1

=A1

In the end, you'll have:

   |   A    |   B
----------------------------------------------------
 1 | 12760  |  12760
 2 | 15464  |  2704
 3 | 17162  |  1698
 4 | 19808  |  2646
 5 | 22757  |  2949
 6 | 25450  |  2693

(If this isn't what you're after, then please edit your question to provide further clarity.)