Note that the format string overrides the cell format, so the returned text displays the same regardless of the cell number format. Microsoft recommends use of the Text function, with the format string “h:mm”. This shows the correct result if formatted as a decimal, but if is formatted as time it shows the wrong value. The first row shows the result of multiplying the date difference by 24. The screen-shot shows various alternatives for displaying the number of hours between the date/time in cell B3 and the start of the date in B2. If we want the time in hours and minutes (or hours minutes and seconds), things get a bit more complicated:
To calculate the number of hours between two dates we can simply subtract the two values and multiply by 24. Dates and times in Excel are stored as a date number, which is the number of days since 1 January 1900, with the value after the decimal point representing the time of day.