# Find Date Time difference only IF a certain single select field is selected

Topic Labels: Formulas
Solved
830 3
cancel
Showing results for
Did you mean:
5 - Automation Enthusiast

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

Specific Single Select is “Teaching”

1 Solution

Accepted Solutions
18 - Pluto
``````IF(
DATETIME_DIFF({Time Out},{Time In},‘minutes’) / 60
)
``````

Should work, but can’t test it easily; lemme know if it’s buggy

3 Replies 3
9 - Sun

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.)

18 - Pluto
``````IF(