# "Late Ad" formula

Topic Labels: Formulas
Solved
Jump to Solution
1074 2
cancel
Showing results for
Search instead for
Did you mean:
5 - Automation Enthusiast

I have people submitting records through a form. Records have {Date Ordered} field with creation date. The records are ads that go into publications so there’s a {Print Date} field. I want to flag all orders that come in the day before or the day of print date with “Late Ad” how do I do this?

1 Solution

Accepted Solutions
14 - Jupiter

Hey @Andy_Taylor,

This should be pretty simple, if I understand it correctly. There’s a `DATEFIME_DIFF()` function that will get you what you want:

``````IF(
DATETIME_DIFF(
{Date Ordered},
{Print Date},
'days'
) > -2,
"⛔️ Late Ad"
)
``````

Since `{Print Date}` will be subtracted from `{Date Ordered}`, any ads submitted that are not “Late” will return a value of `-2` days or lower (where `-2` means submitted 2 days before `{Print Date}`, `-3` means submitted 3 days before `{Print Date}`, and so on). So anything greater than `-2` is an ad that was submitted the day before, day of, or else after (which is impossible, but the case is covered still…).

2 Replies 2
14 - Jupiter

Hey @Andy_Taylor,

This should be pretty simple, if I understand it correctly. There’s a `DATEFIME_DIFF()` function that will get you what you want:

``````IF(
DATETIME_DIFF(
{Date Ordered},
{Print Date},
'days'
) > -2,
"⛔️ Late Ad"
)
``````

Since `{Print Date}` will be subtracted from `{Date Ordered}`, any ads submitted that are not “Late” will return a value of `-2` days or lower (where `-2` means submitted 2 days before `{Print Date}`, `-3` means submitted 3 days before `{Print Date}`, and so on). So anything greater than `-2` is an ad that was submitted the day before, day of, or else after (which is impossible, but the case is covered still…).

5 - Automation Enthusiast

Thank you! I couldn’t wrap my brain around it. Very helpful!