Ok, I checked your xls file, but when calculating deviation, why are you using formula =SQRT(B18/(4-1)) when the number of laps was 5 and the first one was already excluded? But thats not the problem, those numbers are still quite wrong.
------
Edit:
Here's an easier example. From the stats you posted we see that
16.[NRG]Mark Novys (Mark Novys) 2.45 +2.22 5
now, if we input his laptimes to xls file you provided
935500
828700
793900
887500
975800
we get
Deviation= 79557,29068 0 7,96
---- ps. Do you have some variables overflowing in your code, as it seems that the numbers are off if the (Avg-LapTime)^2 is large?
I checked and recheked my calculations but still I get the same numbers. Even without calculating anything you can clearly see that in race one there is much more deviation on the times than in race two, and still it says that deviation for race one is lower...
Edit: See attached txt-file for some calculations.
Edit: Removed attachment
I have one question though... is there a bug in the lap time stability calculations or have I misunderstood something? We drove two races on the same track with the following lap times
Edit:
No need for times anymore as the program was fixed