In a form, custom function to recalculate a number of fields on update of multiple other fields

In a form, custom function to recalculate a number of fields on update of multiple other fields

I have a form which contains 2 fields (disabled from entry) that I want to update with a recalcuation based on updates being done to anyone of 4 other fields on that same form.   Have tried a number of different way, but it seems the only way is to put the code against the 'On Update' action for all of the 4 dependant fields?  

Thanks in advance