iWork Numbers How To Calculate - In Once Cell Function - The Elapsed Time In Hours Between Two Date/Times?
Let's say I have two date/times. The start date/time is 29th May 2020 at 20:30 and the end date/time is 30th May at 02:30. This link shows how to calculate using two cell references.
How to calculate in one cell the duration?
Something like DATEDIF but accepting the time and output of result in hours, e.g.:
=MYCLEVERDATETIMEDIFF(“29/5/20 20:30”, “30/5/20 02:30”, "H")
which results in:
6
Six being the elapsed time in hours between the above date/times.
What function, or combination of functions and conversions would do the trick? Note that ideally something that works as one cell function, not calculating the difference between two cell references.
Any ideas?
Assuming I have understood what you wish to accomplish correctly, here is one way of doing it in the same cell if you are willing to enter the dates and the times separately:
And here is the text version of the formula shown above
=(DATEDIF(DATE(2020,5,29),DATE(2020,5,30),"D")+TIMEVALUE("02:30")−TIMEVALUE("20:30"))×24
Unfortunately, this can not be done by entering the date & time together for each point in time (or without entering them more than once). It appears that there is no date & time function in Numbers that calculates the difference between two date & time values in hours directly or one that fully converts a date & time value in text or otherwise to a proper date & time value that Numbers can process.
Just click a cell and type the equals sign, then add DateDif(ref cell 1, reference cell 2,"D"). You can enter reference cell 1 and 2 by just clicking on the proper cell. This command will return the number of days between the two dates. It is done in one cell.