# Time Calculation

#### kiko2max

##### New Member
Hello Masters, can someone help me to build the formula of time calculation. Let say I have 1 employee, he is working from 8am to 4pm a day (8 hours/day). Then I gave him a task yesterday start 8am and finish it today on 10am. The computation it must be 10 hours only. How can i make a formula for this?

thank you masters

### Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.

##### Well-known Member
Try This:

Mail Generator2.xlsm
ABCDEF
1StartEndHours
211/13/2020 8:0011/14/2020 10:0010:00:00
311/14/2020 8:0011/14/2020 15:007:00:00
4
Sheet1
Cell Formulas
RangeFormula
E2:E3E2=DAYS(C2,B2)*8/24 +MOD(C2,1)-MOD(B2,1)

#### kiko2max

##### New Member
Try This:

Mail Generator2.xlsm
ABCDEF
1StartEndHours
211/13/2020 8:0011/14/2020 10:0010:00:00
311/14/2020 8:0011/14/2020 15:007:00:00
4
Sheet1
Cell Formulas
RangeFormula
E2:E3E2=DAYS(C2,B2)*8/24 +MOD(C2,1)-MOD(B2,1)
Master THANKS A LOT!!! Now it is working!!!

##### Well-known Member
You're Welcome & Thanks for feedback.
And change Result column Number format to Custom and type [h]:mm:ss

#### kiko2max

##### New Member

Th
You're Welcome & Thanks for feedback.
And change Result column Number format to Custom and type [h]:mm:ss
Thank you master, my next task is to get the average time.

#### kiko2max

##### New Member
Hello master, what if i get ####### and convert it to zero? What is the formula?

##### Well-known Member
Are you have negetive results?
If Yes Then:
Excel Formula:
``=IF(DAYS(C2,B2)*8/24 +MOD(C2,1)-MOD(B2,1)<0,0,DAYS(C2,B2)*8/24 +MOD(C2,1)-MOD(B2,1))``

#### kiko2max

##### New Member
Yes Im getting negative time because the database is trash. Anyway thanks again. You really help me a lot. God bless

Replies
1
Views
392
Replies
7
Views
216
Replies
6
Views
207
Replies
3
Views
176
Replies
5
Views
216

1,130,119
Messages
5,640,233
Members
417,131
Latest member
Seanr19871

### 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