Can you post the entire custom function?
Here is the Custom Function with 2 parameters StartDate and DueDate.Int ( ( DueDate - StartDate ) / 7 ) * 5+Case (DayOfWeek ( DueDate ) < DayOfWeek ( StartDate ) ;Min ( 5 ; DayOfWeek ( DueDate ) - 1 ) + Max ( 0 ; 6 - DayOfWeek ( StartDate ) ) ;DayOfWeek ( StartDate ) < 7 ;Min ( 6 ; DayOfWeek ( DueDate ) ) - DayOfWeek ( StartDate ) ;0)
I think that you'll need another number field, FinalDaysPassed that is set to the value of this calculation via a set field step in a script. The script can be run from the OnObjectSave Trigger on your action field.
Then you dayspassed calculation field can be modified to include an if or case function that returns the value of FinalDaysPassed if the action field is not empty but returns your current calculation if it is empty.