My first reaction is: Don't. Never do. Project does that, it's not your job.
This being said, this is how Project does it
%Complete = 100 * Actual Duration / Duration
%Work Complete= 100 * Actual Work / Work
Customize one of the custom duration fields with the formula =[Actual
Duration] and make sure the formula is applied to summary tasks and the
project summary task. The latter will show the project total.
Hope this helps,
Pardon me for bumping in. If you display the project summary task
( Tools > Options, View tab) and then show the tracking table,
you'll see total actual duration is already calculated for you at
the project summary task line as well as for all other summary
tasks.