Search code examples
exceltimeexcel-formulasubtractionexcel-2019

How do I automatically subtract time data of previous row from current row in Excel?


Here's what I want to achieve:
Here's what I want to achieve

In the example, I manually subtracted the value of the previous cell from the cell.
For example:
For cell C2, I used =A2-A1
For cell C3, I used =A3-A2
For cell C4, I used =A4-A3

And so on.

How do I make this process automatic so that every time I enter a value in the column A, the last cell of a column would automatically get subtracted from new entered value. How do I achieve this?


Solution

  • You can create an actual Excel table out of this data. Select the whole "table" and use
    Insert -> Table

    Then after you enter a new value at the bottom of the table it will become part of the table and the formula in column C will automatically be created.

    For this to work you need that column C would have the same formula (can be pasted down). E.g. for me this formula worked:
    =IF(ISNUMBER(A1),A2-A1,"")

    enter image description here

    To make formatting like you want you can change the number format of column C to:
    [mm] "Minutes"
    Deciding from the image in the question it seems you know how to do it.