Numbers time duration formula

Hi I have added the following code to my sheet, which has 7 days(columns). I what to keep track go my working week. working 5 days out of 7.

the problem, error I have is how do I tell the formula that there will be days that will not have a start and finish time.

I want to see how many hours worked per week, but also show the days not working as "day off" or holiday'

but the formula does not accept that wording


Here's the code I'm using, changing the (D) and (C) values to match each column

=24*(TIMEVALUE(D)-TIMEVALUE(C)+IF(TIMEVALUE(D)<TIMEVALUE(C),1,0))


any help would be much appreciated

MacBook Pro 15″, macOS 12.7

Posted on Mar 28, 2025 10:11 AM

Reply
6 replies
Sort By: 

Mar 28, 2025 10:47 AM in response to rbspro

Can you provide more info? I can't visualize your table to be able to work out what you're trying to do.


You say you have 7 columns, one per day. It isn't clear what values are in those columns, or why TIMEVALUE() would be appropriate.


It also isn't clear where this formula is going. You say you're referring to columns D and C, but where is this formula? You only have 7 columns (one per day).


Also, TIMEVALUE() takes a date string and returns a fraction of day. It can't take a column input


So, in all, I can't see what you're working with, and I can't understand what you're trying to achieve. More detail may help. A screenshot of your worksheet might be a good starting point.

Reply

Mar 28, 2025 10:50 AM in response to rbspro

Without a screenshot it's hard to tell exactly what you are doing but if you haven't do so already you might have a look at the E'mployee Schedule' template (at File > New).


In the 'Sign In' table it has a formula that uses ISBLANK to handle cases where there is not both a time In and a time Out.





SG

Reply

Mar 28, 2025 12:12 PM in response to rbspro

That's a very complex spreadsheet, and no way I (or anyone?) could have discerned your ask from the original post.

It's also very Excel-esque in putting the calculations off screen in columns Z+. Nothing inherently wrong with that, but a Numbers' way would be to use a separate table. Either way.


I'll assume for now that you have the basic logic down in terms of calculating hours, so I'm not going to re-invent the wheel. I think your easiest approach is to just wrap the existing formulas in an IFERROR(). This will catch errors and may be sufficient.


So, instead of:


=24*(TIMEVALUE(D)-TIMEVALUE(C)+IF(TIMEVALUE(D)<TIMEVALUE(C),1,0))


say something like:


=IFERROR(24*(TIMEVALUE(D)-TIMEVALUE(C)+IF(TIMEVALUE(D)<TIMEVALUE(C),1,0)),0)


This runs the exact same function you have, but if a non-time value in the cell triggers an error then IFERROR() catches it and returns 0


I'm still confused by your formulas that seem to reference entire columns - e.g. TIMEVALUE(D) - rather than specific cells such as TIMEVALUE(D7), but if it's working I'm not going to touch that :)

Reply

Mar 28, 2025 12:38 PM in response to Camelot

Camelot, Thank you this works perfectly. I have only coded 1 line so far, so your comment re referencing entire columns may will need to change for each cell (D7),(D8) and so on.

I just wanted to get 1 line working before moving on. I'm new to numbers/excell but as a old html and css coder though this would be easier then it is. My logic was that by doing a separate table for the adding of hours, money would be less confusing. Once again many thanks for your help and code.

Reply

Numbers time duration formula

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.