I recently used this formula for time calculation within one cell and it worked great!

But I remained with a top up question: Is there a way to allow breakdown hours?

For example, using this:

9pm - 4:30pm

Instead of this:

9pm - 4.5pm

I know I could type 4.5pm, but I'm afraid people would read 4:50pm instead of 4:30pm.

2 Answers 2


It looks to me like those formulas don't parse times in the format 3:24pm. So no, not while keeping the formula intact.

I believe I've got the formulas working, using TIMEVALUE instead of TIME.


@FlexYourData points out a bug in my original answer (at the bottom); part of this is due to my unintentional omission of the pm from the parsing.

The other part is that TIMEVALUE doesn't seem to like times without spaces.

So here's a version that doesn't care about spaces.

Cell B2:

=TIMEVALUE(LEFT(A2,FIND("-",A2)-3)&" "&MID(A2,FIND("-",A2)-2,2))

Cell C2:

=TIMEVALUE(MID(A2,FIND("-",A2)+1,LEN(A2)-FIND("-",A2)-2)&" "&RIGHT(A2,2))

Cell D2—no change to this one:


Original answer (with minor corrections). These formulas only work with 3:24 pm and 3 pm times--note the space. I like them, though, because they're simpler. Perhaps you could require times to be entered in this format.

Cell B2:


Cell C2:


Cell D2—no change to this one:

  • +1 for use of TIMEVALUE. The formulas may need some modification since TIMEVALUE requires the time_text parameter to be a text-formatted time and returns a #VALUE! error if a single integer is passed to it, as in the case of the "9" from "9pm" Jan 11, 2022 at 14:16
  • @FlexYourData: Rats, you're right. I think I've fixed it.
    – Mathieu K.
    Jan 13, 2022 at 4:50

Doing this with formulas is somewhat painful, so I've used LET to hopefully make it easier to read. It would be much easier to use PowerQuery, but I think this will work. If you have access to LAMBDA, which unfortunately I don't, I recommend using that.

First of all, I've defined the start/end separator, i.e. " - ", as a Named Cell called "sep" in cell B2:

enter image description here

I've done that so if you want to change it to "-" or something else in the future, you won't have to change it in several places in formulas, but rather just in that one cell.

With Helper Columns for Start and End

The approach here is broadly:

  1. determine the position of the separator in the string and call that "pos"
  2. return the time as text and call it "str"
  3. determine if the time as text contains minutes (indicated by presence of a colon) and call that "hasmin"
  4. calculate the time representation of "str", which is modified from the original answer you used, but taking different action depending on whether "hasmin" is TRUE or not

Start time formula in B3:


End time formula in C3:


Hours elapsed formula in D3:


As a single formula

Here I have just combined the two "Start Time" and "End Time" columns into the same LET, calling them "from_time" and "to_time". The last expression, i.e. the result, is then just the formula in the "Hours elapsed" column, but referring to the names in the LET function instead of the columns.

In E3:




  • Interesting! Fyi, the LET function may not be available to everyone yet.
    – MiG
    Jan 11, 2022 at 17:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .