Recurring tasks only on weekdays

I have searched and searched and I cannot find my answer.
I have a tasks table with category, due date, occurrence, next due date. Category is either work or personal. What I want is, if category is work, next due date to only be scheduled on a weekday.

The formula I’m using to get next due date is:

SwitchIf(thisRow.Occurrence=Daily,thisRow.[Due Date]+Days(1),thisRow.Occurrence=Weekly,thisRow.[Due Date]+Days(7), thisRow.Occurrence=Monthly,RelativeDate(thisRow.[Due Date],1 ),thisRow.Occurrence=[3 Months],RelativeDate(thisRow.[Due Date],3 ),thisRow.Occurrence=[6 Months],RelativeDate(thisRow.[Due Date],6 ),thisRow.Occurrence=Yearly,RelativeDate(thisRow.[Due Date],12 ))

Any ideas??

I might also mention, I’m fairly new to Coda.

Thank you!!

Hey there! You can definitely accomplish what you are looking to do - but it’s hard to provide specific guidance without knowing more about your doc or larger context.

Share a copy of your doc here and I’m happy to help out!

Ok, I feel a bit silly but I have no idea how to share my doc here. Can you point me to instructions? :-); I think I figured it out!

1 Like

@Renae_Jording

Hello,

To share your documents here is the method to follow given on this page.

Sincerely yours,
Thierry

and this for your recurring task’s

2 Likes

You are so close! You need to set the settings so that “anyone who has link can view”

1 Like

Made change to allow view.

Thanks!

So what you are doing is wanting that blue button in screenshot below to add a row to your Tasks table but always default to next weekday IF the category is Work?

Any clarification on your goal is helpful! Then ill get it working for you

2 Likes

If you look at the Database tab, it’s the column called Next Due Date that I’m trying to fix. As in this example, May 5 is a Thursday and this task occurs monthly and in June the 5th is a Sunday. I am trying to get the next due date to move it to the next weekday (M-F) but only if the Category column is Work.

I hope that helps explain.

Thank you!!

How do I combine workday and relativedate? I figured out the workday daily and weekly but I can’t figure out the workday monthly and yearly. Also, to get it to skip holidays, do I have to create a table and list out every holiday manually?

Thank you!!

I did a similar project for my IT Team task list. I ended up using a switch if formula (below) to provide the due dates automatically upon them clicking the “mark as done” button. Then I use a filter to show only the items relative to the week they are due.

The formula I used for the due dates is

SwitchIf(thisRow.Recurring=“Monthly”,thisRow.[Due Date]+Days(30),thisRow.Recurring=“Quarterly”,thisRow.[Due Date]+Days(90),thisRow.Recurring=“Yearly”,thisRow.[Due Date]+Days(365),thisRow.Recurring=“Daily”,thisRow.[Due Date]+Days(1))

Then I added a filter for If Due Date is within the next seven days.

Hope this helps.

Thank you Terry_Stagg. I’m attempting to find a way to have the recurring tasks only on workdays.

I figured out the daily and weekly but I don’t know how to combine workday and relativedate for the monthly and yearly.

Daily and weekly only scheduled on workdays (M-F):
SwitchIf(thisRow.Occurrance=“Daily”,workday(thisRow.[Due Date]+Days(0),1 ), thisRow.Occurrance=“Weekly”,Workday(thisRow.[Due Date]+Days(6),1 ))

Ah sorry I missed that part of your question. I would like to have that solution to just for cleanliness of the task list. I have no doubt that @Scott_Collier-Weir will have a simple solution for this.

Hi @Renae_Jording :blush:

I’m pretty sure there could be better way to do this but I sadly don’t have much time right now :pensive:

How about this though :

SwitchIf(
  thisRow.Occurrence = Daily,
  thisRow.[Due Date].Workday(1),
  thisRow.Occurrence = Weekly,
  thisRow.[Due Date].Workday(7),
  thisRow.Occurrence = Monthly,
  If(
    thisRow.[Due Date].RelativeDate(1).Weekday() != 1 AND thisRow.[Due Date].RelativeDate(1).Weekday() != 7,
    thisRow.[Due Date].RelativeDate(1),
    thisRow.[Due Date].RelativeDate(1).Workday(1) 
  ),
  thisRow.Occurrence = [3 Months],
  If(
    thisRow.[Due Date].RelativeDate(3).Weekday() != 1 AND thisRow.[Due Date].RelativeDate(3).Weekday() != 7,
    thisRow.[Due Date].RelativeDate(3),
    thisRow.[Due Date].RelativeDate(3).Workday(1) 
  ),
  thisRow.Occurrence = [6 Months],
  If(
    thisRow.[Due Date].RelativeDate(6).Weekday() != 1 AND thisRow.[Due Date].RelativeDate(6).Weekday() != 7,
    thisRow.[Due Date].RelativeDate(6),
    thisRow.[Due Date].RelativeDate(6).Workday(1) 
  ),
  thisRow.Occurrence = Yearly,
  If(
    thisRow.[Due Date].RelativeDate(12).Weekday() != 1 AND thisRow.[Due Date].RelativeDate(1).Weekday() != 7,
    thisRow.[Due Date].RelativeDate(12),
    thisRow.[Due Date].RelativeDate(12).Workday(1) 
  )
  )

It is not very pretty to look at but it seems to work in your doc (which I didn’t modified though :innocent: )

Each Monthly, 3 months … Occurences conditions of your SwicthIf() I ask the formula to check first (with a simple If()) if the next due day is not a Sunday (Weekday != 1) or a Saturday (Weekday != 7) …
If this is True, the If() returns :

thisRow.[Due Date].RelativeDate(1)

I.e.: The Due Date + 1 month

else, it returns :

thisRow.[Due Date].RelativeDate(1).Workday(1)

I.e.: The working day coming after the Due Date + 1 month

You could also choose the previous working day by using this (for the else part of the If()), instead :

thisRow.[Due Date].RelativeDate(1).Workday(-1)

In its entirety, the part regarding your Monthly occurence looks like this :

SwitchIf(
[ ... ]

 thisRow.Occurrence = Monthly,
  If(
    thisRow.[Due Date].RelativeDate(1).Weekday() != 1 AND thisRow.[Due Date].RelativeDate(1).Weekday() != 7,
    thisRow.[Due Date].RelativeDate(1),
    thisRow.[Due Date].RelativeDate(1).Workday(1) 
  )

[ ... ]
)

I’m sorry I can’t do much more right now, but I hope this helps :blush:

3 Likes

THANK YOU @Pch! It works beautifully!! I so appreciate your help. Have an amazing day!!

2 Likes

Then knocks it out of the park.

2 Likes

Glad to know it helped :grin: !


I tried :wink: … Thank you :blush: .

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.