Help

Upcoming database upgrades. Airtable functionality will be reduced for ~15 minutes at 06:00 UTC on Feb. 4 / 10:00 pm PT on Feb. 3. Learn more here

How to substract lunch time

Topic Labels: Formulas
208 4
cancel
Showing results for 
Search instead for 
Did you mean: 

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!
Capture d’écran, le 2022-10-12 à 15.47.27

4 Replies 4

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}

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!

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

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!