Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
How do you calculate time if the time period is typed
in one cell. example:Cell A1: 0500 - 1530
Cell B1: 1200 - 1830
Cell C1: 1300 - 2230My main goal is to post a sheet that has everyones
shift times per day, with the amount of hours
calculated at the end of each row. Keep in mind,
every shift also gets a 30 min unpaid lunch, so I need
to factor that in as well. And whenever I change the
time of the shift in each cell, I would like the hours to
adjust itself.PLEASE HELP ME!

Is the format of the time range always going to be 4 characters followed by "-" followed by 4 characters? If so (and you're using MS Excel), try using the formula =MID(B2,6,4)-MID(B2,1,4) where B2 is the cell containing the time span characters and the second argument is the starting character position in the cell and the third argument is the number of characters. You'll have to adjust the cell number and the starting position of the character string in your own application.

I would advise against doing it this way, you would be better off breaking the single cell into two separate time cells, but if you must, try this:
=TIME(MID(B1,8,2),MID(B1,10,2),)-TIME(MID(B1,1,2),MID(B1,3,2),)-TIME(,30,)
It will display the answer in a Time format such as 10:30 and then subtract the 30 minutes for lunch and give you 10:00.

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |