Creating a time sheet with time calculation

DrunknMunky14

New Member
Joined
Jun 4, 2014
Messages
15
Hi all,
Been a while since I last posted here.

I'm trying to create a time sheet which takes hours and minutes but not the time.
For example, a job takes 18 hours and 23 minutes and come out of a CSV file as 18:23, but the allocated time is only 15 hours (shown as 15:00), I want to be able to get -3 hours and 23 over the allocated time as -3:23.

Right now I'm getting thrown a #VALUE! error because time can't be negative.

What is the right cell format to achieve this?
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
If you change the format of the negative value to a number you will see a negative number that can be used in a calculation but that's not very attractive.

Alternatives
Convert to decimal time and use that to do the calculations.

Sheet1

*ABCDE
1StartFinishDifferenceAllocDecimal Time Difference
26:0014:008:0010:002
36:0017:3011:308:00-3.5
46:0014:008:008:000

<colgroup><col style="font-weight:bold; width:30px; "><col style="width:64px;"><col style="width:64px;"><col style="width:73px;"><col style="width:64px;"><col style="width:92px;"></colgroup><tbody>
</tbody>

Spreadsheet Formulas
CellFormula
E2=(INT(D2)*24+HOUR(D2)+ROUND(MINUTE(D2)/60,2))-(INT(C2)*24+HOUR(C2)+ROUND(MINUTE(C2)/60,2))

<tbody>
</tbody>

<tbody>
</tbody>


Excel tables to the web >> Excel Jeanie HTML 4



Another method is to have the positive values in one column and the values that should be negative in the other as follows (Note on-schedule is blank in both columns).


Sheet1

*ABCDEF
1StartFinishDifferenceAllocAhead of Alloc.Behind Alloc
26:0014:008:0010:002:00*
36:0017:3011:308:00*3:30
46:0014:008:008:00**

<tbody>
</tbody>

Spreadsheet Formulas
CellFormula
E2=IF(D2>C2,D2-C2,"")
F2=IF(C2>D2,C2-D2,"")

<tbody>
</tbody>

<tbody>
</tbody>


Excel tables to the web >> Excel Jeanie HTML 4
 
Upvote 0
Hi Steve,

That isn't exactly what I'm after.

I'm using hours and minutes, not in a 24 format, but more as a numerical format.

Job NoTime Spent on JobTime Allocated to JobTime Remaining
J0000156:0026:00-30:00
J0000218:3020:001:30
J000032:483:000:12

<tbody>
</tbody>

The bold is what I'm trying to get from a formula. All cells are in a hh:mm style and that's what I'm given from the CSV file. They can be changed to hh:mm:ss if needed.
 
Upvote 0
Sorry, I thought I posted another option after that that gives you what you want but there is a catch.

This one gives the display you want but the negative time display is a string (so Excel aligns if left until you change it). The catch is that value cannot be used in subsequent calculations without more work:

Excel 2010
ABCD
1Job NoTime Spent on JobTime Allocated to JobTime Remaining
2J000018:002:00-30:00
3J0000218:3020:001:30
4J000032:483:000:12

<tbody>
</tbody>
Sheet1

Worksheet Formulas
CellFormula
D2=IF(C2>B2, C2-B2,"-" & TEXT(B2-C2,"[h]:mm"))

<tbody>
</tbody>

<tbody>
</tbody>


If you change to the 1904 system for the WB, the format you need is
+[h]:mm;-[h]:mm

<tbody>
</tbody>

But changing to 1904 system will change any dates in the WB.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,832
Messages
6,121,853
Members
449,051
Latest member
excelquestion515

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.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

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

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

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
Back
Top