# Timesheet: easy entry, then calculate

#### Mahpie

##### New Member
Hi lovely Excel forumers. I've searched, but I keep finding things that are quite different from what I want to do.

I am making a timesheet entry form.

I want people to be able to enter the time in 4 key presses (e.g. for 12:45, I just want them to be able to type 1245, and not need to mess about entering a colon in the middle).

To get that to work (for some value of "worked"), I changed the format of the cells to a custom number type: 00\:00

But, of course, when it goes to calculate 1200 - 0830 (to work out hours worked in the morning) it gets 03:70. Which is bad.

So data entry is fine - it looks great! But I'm guessing I need to convert those numbers back into times before I can do the "end time minus the start time = hours worked" calculations, right?

So assuming the users aren't dopes and actually enter valid times, is there a way I can convert times in the format of 00\:00 into actual hh:mm format?

### Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
Hi and welcome to MrExcel,

With changing the number format to create an easy input you've changed the actual input from time to general number and hence the calculation of 12:00 -/- 08:30 will in fact be 1200-830.

You were on the right track with the remark to convert the numbers back into time.

try this:

Book1
ABCDEFG
108:3012:008:30:0012:00:003:30:003,50
Sheet1
Cell Formulas
RangeFormula
D1=TIME(LEFT(A1,IF(LEN(A1)=3,1,2)),RIGHT(A1,2),)
E1=TIME(LEFT(B1,IF(LEN(B1)=3,1,2)),RIGHT(B1,2),)
F1=E1-D1
G1=(E1-D1)*24

Cells D1,E1`and F1 and cell with a time format [hh]:mm

Hope this helps.

Last edited:
Thank you so much for the very quick reply. I'll give that a go on Monday and report back!

Hi and welcome to MrExcel,

With changing the number format to create an easy input you've changed the actual input from time to general number and hence the calculation of 12:00 -/- 08:30 will in fact be 1200-830.

You were on the right track with the remark to convert the numbers back into time.

try this:
ABCDEFG
108:3012:008:30:0012:00:003:30:00 3,50

</tbody>
Sheet1

Worksheet Formulas
CellFormula
D1=TIME(LEFT(A1,IF(LEN(A1)=3,1,2)),RIGHT(A1,2),)
E1=TIME(LEFT(B1,IF(LEN(B1)=3,1,2)),RIGHT(B1,2),)
F1=E1-D1
G1=(E1-D1)*24

</tbody>

<tbody>
</tbody>

Cells D1,E1`and F1 and cell with a time format [hh]:mm

Hope this helps.

It worked! Thanks heaps.

I did have to allow for errors, since blank entries gave me the dreaded #VALUE! all over the place, which messed up some of the calculations. So the code I used in the end was:

=IFERROR(TIME(LEFT(A1,IF(LEN(A1)=3,1,2)),RIGHT(A1,2),), 0)

...and formatting took care of the rest.

Thanks again!

Replies
1
Views
154
Replies
4
Views
259
Replies
16
Views
869
Replies
4
Views
247
Replies
18
Views
779

1,216,487
Messages
6,130,947
Members
449,608
Latest member
jacobmudombe

### We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.

### Which adblocker are you using?

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

### Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

### Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back