Date & Time
TIMEVALUE function: convert text clock strings into fractional day numbers
Parse imported "14:30" or "2:30 PM" text strings into decimal time values with TIMEVALUE so shift arithmetic works.
Convert text timestamps to decimal fractions of a 24-hour day
TIMEVALUE(time_text) converts a text clock string such as "09:30" or "18:00" into its fraction of a 24-hour day (0.395833... and 0.75). Multiply the difference by 24 and round to 4 decimal places to get exact elapsed hours.
Passing a number instead of text or an invalid clock string like "25:99" returns #VALUE!.
=ROUND((TIMEVALUE(B2) - TIMEVALUE(A2)) * 24, 4)Try the example
Use the original values or change them to test your understanding.