Save the date! Join us on October 16 for our Product Ops launch event. Register here.
Oct 08, 2021 02:36 PM
Hello! I’m able to make this formula work but I keep getting errors when I try to insert ‘WORKDAY’ into it:
IF({Original Release Date}, DATEADD({Original Release Date}, VALUE(’’ & {Days Needed Before Release}), ‘days’, ‘’))
I am trying to return the closest workday after subtracting a formulated number of days from my original release date.
Thanks!
Solved! Go to Solution.
Oct 11, 2021 01:01 PM
If you’re only getting errors because some of your inputs are blank, adjust the IF() clause to account for that:
IF(
AND({Original Release Date}, {Days Needed Before Release}),
WORKDAY(DATEADD({Original Release Date}, VALUE({Days Needed Before Release}) + 1, "days"), -1)
)
or
IF(
AND({Original Release Date}, {Days Needed Before Release}),
WORKDAY({Original Release Date},{Days Needed Before Release})
)
Oct 08, 2021 04:41 PM
Your formula appears to have quotation marks and parenthesis in the wrong places. I believe your formula should look like:
IF(
{Original Release Date},
DATEADD({Original Release Date}, VALUE(""&{Days Needed Before Release}), "days")
)
Leaving out the “” in the if false
position prevents Airtable from reading the format of the column as a string and not a date. If your values aren’t already negative, include a - in front of VALUE.
Adding in WORKDAY would then look like:
IF(
{Original Release Date},
WORKDAY(DATEADD({Original Release Date}, VALUE({Days Needed Before Release}) + 1, "days"), -1)
)
^ I’m adding one day to the DATEADD because I am assuming {Days Needed Before Release}
is a negative number and because WORKDAY needs to add (in this case subtract) at least one day to function.
Oct 10, 2021 12:00 AM
Aside from what @Kamille_Parks mentioned, there’s one other possible source of the error. The WORKDAY()
function doesn’t accept a units argument like DATEADD()
does; i.e. you actually need to omit the “days” string if you replace “DATEADD” with “WORKDAY” in the formula that you listed. This is because the WORKDAY()
function is designed to only work with days and no other units. (Some of Airtable’s functions will accept extra arguments and not complain about it, but WORKDAY()
isn’t one of them.)
Oct 10, 2021 07:41 AM
@Justin_Barrett I took that to mean they need both DATEADD and WORKDAY to get what they need
Oct 11, 2021 12:51 PM
Thanks, Both! Yes @Kamille_Parks is correct that I’m trying to incorporate both DATEADD and WORKDAY in the same formula, and unfortunately it looks like @Justin_Barrett is also correct in that WORKDAY and DATEADD don’t play well together because @Kamille_Parks’ proposed solution still returns an error…
Most of what I need I can achieve with this simple formula:
WORKDAY({Original Release Date},{Days Needed Before Release})
Except that I am also trying to also avoid returning errors when either of those fields are blank. The best I can come up with is 2 formulas; the one above and then a second (IF) formula to fix the #Error’s because of blanks (which then leads to the additional issue of needing to reformat the date returned)
I hope that made sense. Any suggestions here?
Oct 11, 2021 01:01 PM
If you’re only getting errors because some of your inputs are blank, adjust the IF() clause to account for that:
IF(
AND({Original Release Date}, {Days Needed Before Release}),
WORKDAY(DATEADD({Original Release Date}, VALUE({Days Needed Before Release}) + 1, "days"), -1)
)
or
IF(
AND({Original Release Date}, {Days Needed Before Release}),
WORKDAY({Original Release Date},{Days Needed Before Release})
)
Oct 11, 2021 01:10 PM
Clarifying the original formula you suggested as the solution doesn’t work at all (Errors in every cell). I think due to what @Justin_Barrett said about WORKDAY not accepting units as DATEADD does?
Oct 11, 2021 01:24 PM
Notice how the formula I gave doesn’t have a unit argument for WORKDAY. It has a number argument, which is required.
I tested the formula in my own base and got no errors, can you post a screenshot of yours? (relevant formula field is {Workday Test}
)
Oct 11, 2021 01:28 PM
@Kamille_Parks My bad for the misread.
@Theodora_Hart WORKDAY()
and DATEADD()
can work together as long as the requirements of each function are met. The “days” unit string in Kamille’s formula is part of the DATEADD()
function, not WORKDAY()
.
I’ll second Kamille’s request for a screenshot. That will probably help us find the problem more quickly.
Oct 11, 2021 01:29 PM
The second version of the formula you offered works! Thank you so much! Life saver!