I came in on this one kind of late, after
Starrizzo had already been well advised that times should be stored
as times, not as text strings.
But (largely to amuse myself) I went ahead and came up with the following formulas that will separate the input into actual times in two different fields. This might actually be useful to
Starrizzo if (s)he has a lot of schedules that someone already stored in the "4pm-10pm" format and (s)he now needs to break those times apart.
Say you have "4pm-10pm" in A2:
In B2, type
[tab][COLOR=blue white]=TIMEVALUE(LEFT(A2, FIND("-", A2) - 3) & " " & MID(A2, FIND("-", A2) - 2, 2))[/color]
to get the start time
In C2, type:
[tab][COLOR=blue white]=TIMEVALUE(MID(A2, FIND("-", A2) + 1, LEN(A2) - FIND("-", A2) - 2) & " " & RIGHT(A2, 2))[/color]
to get the end time.
Then in D2 a simple [COLOR=blue white]=C2 - B2[/color] will give you the total scheduled hours.
Yogi - your formula doesn't work for me. I believe it is because the input given in the OP has "pm" in lower case ("4pm-8pm" or "4pm-10pm") and SUBSTITUTE is case-sensitive. it works fine for "4PM-8PM". It would also have trouble with times in the AM.
[tt]_____
[blue]-John[/blue][/tt]
[tab][red]The plural of anecdote is not data[/red]
Help us help you. Please read
FAQ 181-2886 before posting.