Re: How to substract lunch time

927 1
cancel
Showing results for
Did you mean:
6 - Interface Innovator

Hi all!

I have a question about a formula field. In one of my bases, I have time sheets with the following fields :

1. Start (with date) - ‘‘Début affectation’’
2. End (with date) - ‘‘Fin affectation’’
3. Lunch break (total time in minutes) - ‘‘Période temps de repas’’
4. Total time (in minutes) - ‘‘Temps pour feuille’’

The Total time field has the following formula : DATETIME_DIFF({Fin affectation},{Début affectation},‘minute’)

I can’t figure out what to put in the formula to substract the lunch time from the overall hours. Can someone help me? :slightly_smiling_face:

Thank you!

4 Replies 4
8 - Airtable Astronomer

From your description I think you are trying to add a fifth column that is “total time excluding lunch break”?

Make sure the “Lunch break (total time in minutes)” field is of type “Number”. Then in this new column you can simply use the formula:

``````{Temps pour feuille} - {Période temps de repas}
``````
6 - Interface Innovator

Hi Nathaniel!

In fact, I was trying not to add a new field to keep the base as simple as possible, but it does make sense to add a new field and just hide the one that adds up the total time of the day. Thanks for the advice!

8 - Airtable Astronomer

Ah!
You can do it either way. This formula will do all the work in one step:

``````DATETIME_DIFF({Fin affectation},{Début affectation},‘minutes’) - {Période temps de repas}
``````

Do make sure that the “Période temps de repas” is of type Number

6 - Interface Innovator

Great!

It is exactly what I was looking for, but I was putting Période temps de repas at the wrong place (before ‘minutes’). So everything is working just fine. Thank you very much!