Nov 08, 2022 12:27 PM
Surely this is an easy formula, but I just can’t get my brain to bend this way:
I am using Airtable for my timesheet for my employees. I would like to improve upon my existing “Total Hours” formula by showing “Total Hours by task” , and each task is a single select item in another field.
Here’s my “Total Hours” formula currently:
DATETIME_DIFF({Time Out},{Time In},‘minutes’) / 60
Field for the different tasks is aptly named: “Task”
Specific Single Select is “Teaching”
Please help! Thanks!
Solved! Go to Solution.
Nov 08, 2022 09:51 PM
IF(
{Task} = "Teaching",
DATETIME_DIFF({Time Out},{Time In},‘minutes’) / 60
)
Should work, but can’t test it easily; lemme know if it’s buggy
Nov 08, 2022 01:20 PM
I gather you have a fairly fixed set of tasks or projects. With the one example you mentioned (“Teaching”) I’m going to extrapolate and guess a few others: Grading, Office Hours, Class Prep. You’re entering a record for each task with start and end time. And you want to get totals by task.
So why don’t you just group these task records by task and get the summary totals for the Total Hours field?
(Minor side note: Perhaps I misunderstand how you’re using it, but i don’t think I’d call that field ‘Total Hours’. If you have a record for ‘Teaching’ with start time 3pm and end time 4pm, that calculated 1 hour difference is a “total” the way I use the term. It’s something like “Time Spent” (on this one task). “Total” would be what I get when I filter the records (say, for this week) and get the calculated total of all the records for teaching this week.)
Nov 08, 2022 09:51 PM
IF(
{Task} = "Teaching",
DATETIME_DIFF({Time Out},{Time In},‘minutes’) / 60
)
Should work, but can’t test it easily; lemme know if it’s buggy
Nov 09, 2022 07:37 AM
Perfect! Just what I needed. Thank you!