Convert IFTTT Timestamps into Date and Time Values You Can Use

If you use IFTTT to log data in Google Sheets then you might have wondered if you can make any functional use of the timestamp that goes in the first column by default.  In order to use the actual date from the timestamp I have in the past used formulae in a separate sheet (I call it the Interpreter) to duplicate the raw input data and then to extract the date and time.  The reason for needing the separate sheet is that if you include a formula in IFTTT, e.g. =LEFT(A2,LEN(A2)-11) which will give you the date from a timestamp, the cell reference A2 will become invalid after the recipe first runs.  It isn’t possible for IFTTT to compute the correct cell reference to input each time the recipe runs. But the problem with the Interpreter sheet is that you have to keep filling all the formulae down to accommodate new data, or occasionally fill down formulae a couple hundred rows in advance.  So it’s far from ideal.

The ideal situation is to design a formula that can correctly reference the cell with the time stamp without needing to enter an actual cell reference.  That way IFTTT can input it automatically every time the recipe runs.  Well here is a formula that will return the value of a cell itself:

=INDIRECT(CHAR(COLUMN()+64)&ROW())
That will give you a circular reference error, so don’t use that!  We can use the OFFSET() function to reference the cell to the left of itself:
=OFFSET(INDIRECT(CHAR(COLUMN()+64)&ROW()),0,-1)
Or the cell to the left of that:
=OFFSET(INDIRECT(CHAR(COLUMN()+64)&ROW()),0,-2)
So how can this be used to extract the date and time?  If you examine IFTTT timestamps they are all different lengths but the time part of the stamp is a constant number of characters.  Here are a couple of examples:
• February 04, 2016 at 04:09PM
• April 27, 2016 at 09:24AM
The dates are obviously different lengths but the time part is always seven characters long, e.g. “04:09PM”, they can be extracted to provide the time.  To extract the date from the timestamp we just need to cut off the time and the preceding ” at ” part of the string (that’s the last eleven characters of the string).  So the spreadsheet formulae to use are:
• Date:
=LEFT(OFFSET(INDIRECT(CHAR(COLUMN()+64)&ROW()),0,-1),LEN(OFFSET(INDIRECT(CHAR(COLUMN()+64)&ROW()),0,-1))-11)
• Time: 
=RIGHT(OFFSET(INDIRECT(CHAR(COLUMN()+64)&ROW()),0,-2),7)

If you want to set this up in an IFTTT recipe you would have something like this, where {{OccurredAt}} is the marker for where IFTTT will insert the timestamp, and ||| is the marker for a cell division:

{{OccurredAt}} ||| =LEFT(OFFSET(INDIRECT(CHAR(COLUMN()+64)&ROW()),0,-1),LEN(OFFSET(INDIRECT(CHAR(COLUMN()+64)&ROW()),0,-1))-11) ||| =RIGHT(OFFSET(INDIRECT(CHAR(COLUMN()+64)&ROW()),0,-2),7) |||
Hope that’s of help to some of you wanting to work with IFTTT timestamps.
Update 12/10/16
An alternative to the above formulae is to use the IFTTT timestamp string directly in the formula, e.g.
=LEFT(“{{OccurredAt}}”,LEN(“{{OccurredAt}}”)-11)
I’ve had trouble with Google Sheets interpreting the output as a true date value (it interprets it as a string).  To get around that use DATEVALUE(), like this:
=DATEVALUE(LEFT(“{{OccurredAt}}”,LEN(“{{OccurredAt}}”)-11))
Advertisements