I think I have solved it.....
Try changing D317 cell formatting to Number>Custom>[h]:mm:ss
To avoid potential problems in the future, I would change the whole D column to [h]:mm:ss thereby allowing for any hour counts that exceed 24.
As for the number Excel is loading into the formula (e.g. 105) have a look at
http://office.microsoft.com/en-nz/excel-help/subtotal-function-HP010062463.aspx
105 is a min function and 109 = sum etc
Hope this helps.