Apr 02, 2024 01:08 PM - edited Apr 02, 2024 01:09 PM
I'm trying to have the formula with a dateadd calculation be blank of a certain field is blank. However if I put the DateFormat function around the whole If formula it will either result in an error if the input is Blank or if any option could be blank it will not allow the Formula Formatting as a Date field either way. How can AT recognize a formula field as a date field if the date could be blank based on a conditional formula or related blank field???
Solved! Go to Solution.
Apr 02, 2024 04:41 PM
How about this.
IF(
{Weekday Planner},
DATETIME_FORMAT(
DATEADD(
TODAY(),
(({Auto Date 2}-WEEKDAY(TODAY()))*24)+15,
"hours"
),
'MM/DD/YYYY h:hm A'
)
)
Apr 02, 2024 04:41 PM
How about this.
IF(
{Weekday Planner},
DATETIME_FORMAT(
DATEADD(
TODAY(),
(({Auto Date 2}-WEEKDAY(TODAY()))*24)+15,
"hours"
),
'MM/DD/YYYY h:hm A'
)
)
Apr 02, 2024 05:09 PM - edited Apr 03, 2024 04:18 AM
Edit: Whoops, sorry @Sho , didn't mean to post the exact same thing as you! I think I opened the tab when there were no replies and then went to look for coffee or something===
Try this:
IF(
{Weekday planner},
DATETIME_FORMAT(
DATEADD(
TODAY(),
(({Auto Date 2}-(WEEKDAY(TODAY())))*24)+15,
"hours"
),
'MM/DD/YYYY h:hm A'
)
)
Apr 02, 2024 09:17 PM - edited Apr 03, 2024 11:09 AM
The DATETIME_FORMAT() function converts a date to a text string. If you want Airtable to recognize the new date as a date, omit the DATETIME_FORMAT() function.
IF(
{Weekday Planner},
DATEADD(
TODAY(),
(({Auto Date 2} - (WEEKDAY(TODAY())))*24)+15,
"hours"
)
)
Apr 03, 2024 02:33 PM
It does work! I am curious about this formula you all made. Does it help that there is not an actual condition such as {weekday planner}="" ? What does it mean when it is simply If({weekday planner}, X) and there is no other option. Does it mean if it exists or is not blank?, and there's no close out for if/then, is it assumed as well?
Apr 03, 2024 05:26 PM
Although not mentioned in the reference,
If only the field name is indicated in the condition, the value of the field is considered False whether it is FALSE, empty or 0.
The value of FALSE can then be omitted.
Apr 07, 2024 10:38 PM
Thanks, that must be common to use in coding but I'm more of an excel guy, not even VBA. I don't even format anything, I set up these conditionals linearly and read them like a sentence! I need to learn your ways.