I'm sure you've seen code on Notes Net or elsewhere to take a date and adjust by a fixed number of business days. The code usually looks at the current day of the week and adjusts by the fixed number plus some offset. For example, if you want to adjust by 2 business days then if the starting date is Monday through Wednesday you adjust by 2 days, Thursday through Sunday is adjusted by 4 days.

This code will adjust by "x" business days where "x" can be any positive number. The whole key to adjusting by an unknown number of business days is to figure out how many whole business weeks you want to adjust. After the whole business weeks are adjusted, you may or may not end up with a certain number of days left to adjust (anywhere from 0 to 4 since there are 5 business days in a week). Then you can use something similar to the static formula to figure out how much more to adjust.

Note that this formula does not account for holidays - that would add quite a bit to the complexity. Also note that the resulting day will ALWAYS be a Monday through Friday, no matter what you start with. For example, if you start with a Saturday and adjust by zero business days, you'll end up with the following Monday.

This formula assumes two things:
1. There is a field called Start that is the starting date (a date/time field).
2. There is a field called NumDays that has the number of business days to adjust (a number field).

NumFullWeeks := @Integer(NumDays / 5);
ExtraDays := NumDays - (NumFullWeeks * 5);
W1 := @Weekday(Start);
W2 := @Weekday(tempEndingDate);
AdjustValue := (NumFullWeeks * 7) + ExtraDays + @If(W1 > W2; 2; W1 = 1; 1; W1 = 7; 2; W2 = 1; 1; W2 = 7; 2; 0);