jamietr1 / google-docs-writing-tracker

Automation scripts to track writing in Google Docs
187 stars 39 forks source link

avoid throwing #NAME? error when less than 7 days of writing #40

Closed dawaltconley closed 5 years ago

dawaltconley commented 5 years ago

Right now, until there are 7 days of writing for the 7 day average, the avgStart var is a negative number, which creates a #NAME? error in sheets. This is confusing and made me think the script wasn't working right.

My solution was to make avgStart always at least 2, so that for the first week, the tracker averages the available days (however many).

If this is undesired, I could add a condition to output "Not enough data" instead the =AVERAGE formula, so that it avoids calculating, but makes clear to the user that this isn't a bug.

This script is excellent btw. :)

dawaltconley commented 5 years ago

Saw this was a feature of a previous pull request, looks better there.