Help

Trouble with duration portion of DATEADD function

Topic Labels: Formulas
Solved
Jump to Solution
3771 11
cancel
Showing results for 
Search instead for 
Did you mean: 
Dean_Arnold
7 - App Architect
7 - App Architect

Hi there,

I’m trying to use the DATEADD function to calculate an end time for an event.

My formula is:
DATEADD({Timeslot StartTime},{Duration mins},‘minutes’)

{Duration mins} can be a lookup field or a formula field. I’ve tried all formatting options for these fields but none are producing the correct output.

If I make {Duration mins} a text field, the output is correct.

I need to make the formula work with {Duration mins} being either a lookup field or a formula ~ What am I doing wrong?

P.S. I have also tried to troubleshoot the issue by toggling the GMT settings on and off, all to no avail.

Thanks for your help.

11 Replies 11

Thanks for following up!

Peter from Airtable support found an alternate solution:

DATEADD({Timeslot StartTime},ARRAYJOIN({Duration mins}),‘minutes’)

Here is his fully reply:

"I believe I’ve fixed the issue by “wrapping” the reference to the lookup field with an ARRAYJOIN() fuction, which converts the Lookup field from an array to a string (which in turn makes it interpretable by the DATEADD() function).

Totally get that this is not intuitive – I actually raised this very same issue to our product team a few weeks back, and am going to use your message as an opportunity to do so again."

Thanks for sharing what you got from Peter. Another function (that totally slipped my mind) that’s a little more intuitive is the SUM() function. Normally it’s used to add a collection of values, but it works just as well when passed a single value in an array.

DATEADD({Timeslot StartTime}, SUM({Duration mins}), 'minutes')