Duration in Hours (or hh:mm:ss)

M

MJW

Hi All,

I'm currently trying to create a column in a sheet which calculates the age
in hours (or hours and minutes, though hours is optimal) that have elapsed
since the date/time stamp in the column which proceeds it. Is there any way
to manage this outside of a VBA solution? I'm about as green as it gets when
it comes to VBA, and I'm sort of surprised to find that there isn't a
standard function (like datedif) which supports this. Any help would be
greatly appreciated.

Thanks

Jamie
 
S

Sean Timmons

=now()-prior cell

Format cell as time

Will change any time you type into the spreadsheet.
 
M

MJW

Thanks Sean--I considered using "NOW()", but was hung up on the dynamic
nature you mentioned. Of course I just realized moments ago that I'll be
saved as long as I only update it when the data's needed--once I make a pivot
of the data and port that over to the master workbook, it'll be a static
value.

Much appreciated!

--Jamie
 
D

David Biddulph

=NOW()-A1 and format the cell appropriately, such as [h]:mm

If you want it converting to decimal hours, use =24*(NOW()-A1) and format as
General or number.
 
D

David Biddulph

If you don't want to use NOW(), you can put current time into a cell with
control-shift-colon, or current date with control-semi-colon, or both
together with control-semi-colon space control-shift-colon.
 
P

Peo Sjoblom

Note that using Ctrl + colon will truncate the seconds, so even if the
computer's clock is 09:23:58 it will come out as 09:23:00.
 
Top