How to Track Days Since Task Started in Google Sheets
Learn how to track the days since a task started in Google Sheets by automating date entries and calculating the difference using formulas and Google Apps Script.
We wanna track the days since a task started. We have this status column here that we can say in progress and done, but we don't have dates yet, so let's add a date column, date started, and we're going to add a little automation that's going to add the date when we select in progress. We also want. Days since started. That'll count how many days since we've started that task. So let's go to Extensions app script . So we wanna create our function on edit E. That's the event. And with that E, we get the row and the column, and we're gonna say if the row is greater than one, the column is four, meaning the D column here. Our value that we're selecting or editing is gonna be in progress.
Well, we want to go over to the F column and insert a timestamp . So we'll go spreadsheet , get active spreadsheet , get sheet by name, and in our case it's sheet one. Get range . Our range is the row. Our column is gonna be five, sorry, six, set value, new date, and D with a capital date with a capital D and parentheses. We're going to save that now when we select in progress. We have the date that it started. So let's backdate this a little bit like to last week, and let's figure out a formula that's going to give us how many days since it started. Well, we can do today minus this, and we're gonna get a number , right? But we could also do date diff.
We can have our start date , which is going to be our date started and our end date today, and our unit, in quotes D and that's gonna give us the same number , but it's going to be a little bit more, let's say on the nose, don't really know what to say there, but this date diff will give us a weird number if it's blank. So we need to say if is blank, F two comma, comma, and then have that there. So we wanna make sure that once we enter this date as well, maybe we don't want to update this formula all the time. We wanna add a col um, sorry, we, I wanna add a row. Then just have this at date started. So let's actually add this formula as well. So we'll do spreadsheet app, do all of this as well.
Same, and do column seven. And the value we're going to set is. This formula . However, we're gonna do something a little bit different because we have some, uh, quotes in here. We're gonna use back ticks now in this set value. It's always gonna have four here, but we don't want four. We want the row. So we're going to use interpolation, which is dollar sign and curly brackets row. Again, we're gonna use dollar sign , curly brackets, row, and inside this interpolation we're just gonna put the row. And so every single time we add this formula . It's going to be the correct row that it's in. So we do not need to actually have this unless we have in progress.
So if it's the exact date, maybe we also add another if around here. If error , let's just put nothing. ' cause once we add that, we don't need to see it until the next day. So again, interpolate, curly brackets, row. Dollar sign , curly brackets row, and there we have a if error so that we can not get that error until the next day when we have a number . If you want to see this script check out down below in the description. I'll put a link to the sheet there. And if you're wondering how to do way more, or even if you just want it done for you, check out better sheets.co/sheet ops. Sheet Ops is a fully integrated task manager inside of your Google Sheets that combines Google tasks and Google Calendar so you can actually
delegate your tasks to others. And track the tasks all synced up with calendar and tasks. You can even follow up with email or WhatsApp, and you can handle recurring tasks with absolute ease. It's fully customizable for your workflow. Check it out. Better sheets at co slash sheet ops. You are watching better sheets here on YouTube. Make sure you check out this video or this video and subscribe right now to get more tips, tricks, how tos, get more out of your Google sheets than you ever have before. I'm excited to be making a ton more videos here. Ask me questions down in the comments and I will answer them in future videos. But for right now, right here, one of these videos is gonna be your next Google sheet.