Search code examples
arraysgoogle-sheetstimegoogle-sheets-formulaunix-timestamp

Converting Unix into date for every row in column


I have a working formula that could be repeated 1000s of times to return the answers that I require.

=ArrayFormula(if(A2="","",(A2/1000/60/60/24+date(1970,1,1))))

Trouble is the formulas will break as soon as a new row is added or deleted.

The solution to this is to add 'row' to the formula which will allow me to write the formula once and it will return the correct values in every cell in the range.

I tried this formula:

=ArrayFormula(if(ROW(C2:C),(A2="","",(A2/1000/60/60/24+date(1970,1,1)))))

but it returns a formula parse error!

I have seen simple formulas work in this way but I am not sure about the position of the ROW or even if it will work with +date.

Test sheet is here: https://docs.google.com/spreadsheets/d/1tigqy4hKFn0Q7c-3ICyI6WREnsIBFZ2oLO8CEcdxe8w/edit?usp=sharing

Any ideas please?


Solution

  • use in row 1:

    ={"header"; ARRAYFORMULA(IF(A2:A="",,(A2:A/1000/60/60/24+DATE(1970, 1, 1))))}
    

    enter image description here