Calculate Splits for a 5 Kilometer Race
I regularly have to create target splits for a five kilometer (5K or 5,000 Meter) race. This clip creates even mile splits based upon a target finish time.
; by don at htmlfixit.com ; with help from the clips list ; at yahoogroups.com ;get goal time ^!Set %goal_time%=^?[Goal Time (xx:xx)] ;split goal time to minutes/seconds ^!SetListDelimiter : ^!SetArray %time%=^%goal_time% ;convert minutes to seconds ^!Set %time_seconds%=^$Calc((^%time1%*(60))+^%time2%)$ ;calculate seconds per mile ^!Set %seconds_per_mile%=^$Calc(^%time_seconds%/3.107)$ ;do math on seconds per mile ;to get minutes and seconds ;one mile ;minutes ^!Set %minutes_per_mile_target%=^$Calc(FLOOR(^%seconds_per_mile%/60))$ ^!If ^$StrSize("^%minutes_per_mile_target%")$=1 ^!Set %minutes_per_mile_target%=0^%minutes_per_mile_target% ;seconds ^!Set %seconds_per_mile_target%=^$Calc(^%seconds_per_mile%-(^%minutes_per_mile_target%*60);1)$ ^!If ^$StrSize("^%seconds_per_mile_target%")$=3 ^!Set %seconds_per_mile_target%=0^%seconds_per_mile_target% ;two miles ;minutes ^!Set %minutes_per_2mile_target%=^$Calc(FLOOR((^%seconds_per_mile%*2)/60))$ ^!If ^$StrSize("^%minutes_per_2mile_target%")$=1 ^!Set %minutes_per_2mile_target%=0^%minutes_per_2mile_target% ;seconds ^!Set %seconds_per_2mile_target%=^$Calc((^%seconds_per_mile%*2)-(^%minutes_per_2mile_target%*60);1)$ ^!If ^$StrSize("^%seconds_per_2mile_target%")$=3 ^!Set %seconds_per_2mile_target%=0^%seconds_per_2mile_target% ;three miles ;minutes ^!Set %minutes_per_3mile_target%=^$Calc(FLOOR((^%seconds_per_mile%*3)/60))$ ^!If ^$StrSize("^%minutes_per_3mile_target%")$=1 ^!Set %minutes_per_3mile_target%=0^%minutes_per_3mile_target% ;seconds ^!Set %seconds_per_3mile_target%=^$Calc((^%seconds_per_mile%*3)-(^%minutes_per_3mile_target%*60);1)$ ^!If ^$StrSize("^%seconds_per_3mile_target%")$=3 ^!Set %seconds_per_3mile_target%=0^%seconds_per_3mile_target% ;output ^%nl%Mile Splits to Run ^%goal_time% for 5K ^%nl%^%minutes_per_mile_target%:^%seconds_per_mile_target% - 1 Mile ^%minutes_per_2mile_target%:^%seconds_per_2mile_target% - 2 Mile ^%minutes_per_3mile_target%:^%seconds_per_3mile_target% - 3 Mile ^%goal_time%.0 - finish^%nl% ;the end
Sample output from the clip:
Mile Splits to Run 18:10 for 5K 05:50.8 - 1 Mile 11:41.6 - 2 Mile 17:32.5 - 3 Mile 18:10.0 - finish
Keyword: mile, kilometer, k, 5, split, run, even, runner, target, goal, time, minutes, seconds