It will take three formulas. Timevalue, Hour, and Minute. Each of Your times
must be in Text format as in your example.
=Timevalue("8:30 AM") will return 0.354166667
=timevalue("5:30 PM") will return 0.729166667
Subtract your start time from your end time to get the interval (0.375)
Use the Hour function on the interval
=Hour(0.375)
In this case the result will be 9
If there are Minutes in the result, you will do the same with minute.
=minute(0.375)
In this case it will return 0
Now, if the two times cross midnight, unless someone else has a slicker
idea, It will be necessary to break it into two steps by figuring the time
until 11:59 PM and adding it to the time in the next day.