Jul 30, 2020 03:30 AM
Hello !
I made a formula to get all the holidays for the current year automatically and I can’t use that value directly with WORKDAY_DIFF in another formula. I have to copy and paste.
If anyone has the answer I would love to have it, thanks a lot !
Solved! Go to Solution.
Jul 30, 2020 01:06 PM
Thanks for the added detail. It definitely helps to know that you’re using a lookup to pull that into another table. Lookup fields, even if they only pull from a single record, most often return arrays. Because of this, referring to a lookup field in a formula will bring in the array. In your case, where you need to insert this looked-up date string into WORKDAY_DIFF()
, you’ll probably need to convert that array—even though it only contains a single item—back into a string by concatenating it with an empty string:
WORKDAY_DIFF({Start Date Field}, {End Date Field}, {Lookup Field} & "")
Jul 30, 2020 09:34 AM
Welcome to the community, @Arthur_Couge! :grinning_face_with_big_eyes: What formula are you using to get the list of holidays, and what does it output? There may be a way to achieve what you want, but we’ll need more details.
Jul 30, 2020 12:38 PM
Hello Justin, thank you veryy much ! :grinning_face_with_smiling_eyes:
I use two formula, one to get the holidays I want to exclude and another to get them into string, then I use a lookup on another table and I try to get the data from there.
Some screen will be more explicit :
Formulas :
YE being the current year
Nota : I copied a lot from this work : U.K. Holidays for WORKDAY() and WORKDAY_DIFF(). (Bonus: Easter!)
Thanks again !
Jul 30, 2020 01:06 PM
Thanks for the added detail. It definitely helps to know that you’re using a lookup to pull that into another table. Lookup fields, even if they only pull from a single record, most often return arrays. Because of this, referring to a lookup field in a formula will bring in the array. In your case, where you need to insert this looked-up date string into WORKDAY_DIFF()
, you’ll probably need to convert that array—even though it only contains a single item—back into a string by concatenating it with an empty string:
WORKDAY_DIFF({Start Date Field}, {End Date Field}, {Lookup Field} & "")
Jul 30, 2020 01:13 PM
Well… It actually work !
Thank you I didn’t expected it to be an array since there is single quote on the field binded in the lookup, good to know !
Thanks again, have a great day :slightly_smiling_face:
Jul 30, 2020 03:35 PM
Yeah, it’s tough to determine what it is sometimes. I’m working (very slowly) on creating a reference to make it easier to know what types to expect from a lookup field in different situations (field types, single vs multiple links, etc)