sum_log - Custom Google Function

Tired of manually adding up my miles each week and always wondering where I would end up within my weekly target mileage range, I created a custom function for Google Sheets that will automatically parse out Coach Ryan Warrenburg's training plan. It keeps track of both your current mileage and the current range given the rest of the training plan. If you are interested in using it, it can be downloaded from Google's Script Gallery. You can search for it by using the terms "running log" or "Warrenburg".

The interface is pretty simple. All you have to do is enter "=sum_log(range)" (ex. =sum_log(B2:02)) into a cell in the Google Sheet. Sum Log takes in a range of cells formatted like [plan, log, plan, log, ect...] (Multiple rows/weeks can be given to the function)
Sum Log will output the following in miles: current total (minimum given plan-maximum given plan)
Note: Once the log is completely filled out, only the final total will be displayed.


The function expects that all totals will be given as the first distance in the plan/log cell. Distances may be input like the following: (assuming the user ran 1 mile)
1 mile
1 total
1.60934k or 1.60934K
1.60934 kilometers

The function automatically converts all kilometers to miles. So 1.60934k will be output as 1 and 5k will be output as 3.1
The range ie. (min-max) is generated by taking all days that do not have filled out logs and adding in the min and max from the plan.

Sum Log also supports two-a-days. This can be specified by including both 'AM' and 'PM' in your plan/log
Example: a plan might look like "AM: 9-10 miles easily PM: 5 miles easily" - This will be parsed correctly as 14-15 miles for the day. Note: Colons are not required after AM/PM.


Example running plan/log:
Cell A1(Plan): "AM 9-10 miles easily PM 5 miles easily"
Cell A2(Log): "15 total; 10 in the morning, 5 at night"
Cell A3(Plan): "12-13 miles; 3 miles warmup; 7x1 mile starting @ 5:30 and working down to 5:10, each a touch forward off the previous; 2min recovery btw each; easy cool"
Cell A4(Log): "13 miles; 5:33, 5:30, 5:26, 5:24, 5:21, 5:17, 5:14; 3 mile cooldown; surprised I ran as fast as I did - didn't think I would come close to finishing"
Cell A5(Plan): "19-20 miles with pickups of..."
Cell A6(Log): "Ran 20 miles with the pickups between 5:30-5:50; felt slow at the beginning but finished the last 5 miles feeling strong"
Cell A7(Plan): "10-11 miles easy over the course of 2 runs"
Cell A8(Log): "" (Not filled in yet)
Cell A9(Total): "=sum_log(A1:A8)" --> 48 (58-59)

Note: You do not have to start your log with the distance, but the first distance must be the total if 'AM' and 'PM' are not specified.

If you find any bugs, have any questions, or have any feature requests, let me know.