# Multiply a number field by a number and get a duration?

#1

Hi there!

I am trying to figure out the best way to calculate how much time my department spends in classrooms teaching programs. The length per lesson (1 hour) and the number of lessons (6 lessons) in our series is always the same, but we have a different number of classrooms that we teach in per school. I have a number field with the number of classes that we’re teaching at that school and I was hoping to have a formula field where I multiply the number of classes by the 6 lessons and translate the result into a duration. However, when I do that, even with the format for the formula as a duration, I just get “0:00” as the result. Any ideas if there is a way to multiply a number by a duration and get a duration result?

Thanks so much!

#2

Hi!

If I understand you correctly you are teaching six 1hr lessons at multiple schools (each with a different number of classrooms? If that’s the case, I created a mockup:

The formula field just multiplies across the row:

It looks like you may have a blank field in your formula that is being treated as a 0.

Let me know if I’m understanding you incorrectly. If you could send a screenshot of a mockup that’d be helpful.

[edited to fix images]

#3

That’s essentially it!

I was hoping to find a way to not have to enter that there are 6 lessons at a 1 hour duration every time I make a new record, since it’s the same for every school, so was trying to see if it was possible just to have the # of classes as a field in my table and have the duration built into the formula.

What I tried to do, but seem to not be possible, is multiply the # of classrooms by 6 and asked AIrtable to format the result as a duration - but since there isn’t a duration in the formula it just resulted in 0:00.

#4

Actually, your problem is just that Airtable interprets “durations” as “seconds” on the backend. Your formula is multiplying 6*number of classrooms - let’s say it’s 5 - resulting in the value `30` as output.

When you tell it to display the value as a “duration”, it takes the value `30` and displays it as `30` seconds in the field. You have the formatting set to cut off the seconds, and only show accuracy to the minute, so the result is `0` minutes (`0:00`).

What you need to do is multiply the output by the the number of seconds it should represent - 3600. Then, your “Duration” output will show what you are wanting.

#5

Aha, that makes so much sense! Everything is exactly right now. Thank you so much!