Time +/- calculation

Fester675

Board Regular
Joined
Sep 16, 2016
Messages
141
I am developing a flexi-working sheet for employees, and have run into a problem...

For any time input cells, I have used [h]:mm as the cell format. However I need to generate a running balance (either a flexi credit, or a flexi debit).
The sheet has 3 sections -

  1. Day; Date; Morning time in/out; Midday time in/out; Afternoon time in/out - works fine
  2. Worked (sum of actual hrs/min worked); Credit (any additional time credited); Total (total of worked + Credit) - works fine
  3. Standard working day (7:24); Debit (amount less than standard); Credit (amount more than standard); Running Balance - this is where it goes wrong - the first cell (Monday) should take the balance carried forward from a particular cell and either -/+ this figure dependant on whether the Debit or Credit cell is completed. If Running Balance is a (-) figure then it should populate in red font and if (+) figure then it should populate in green.

The main issue is I can't do a formula to +/- on the running balance, dependant if there is a credit or debit overall - or at least, not one that will return my answer in the same [h]:mm format.

Any help is greatly appreciated!
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
The main issue is I can't do a formula to +/- on the running balance, dependant if there is a credit or debit overall - or at least, not one that will return my answer in the same [h]:mm format.

Hi, I think you're going to need to post some sample data - try to include what the expected results should be in relation to the sample data and if not obvious provide an explanation of how those expected results were arrived at.
 
Upvote 0

Flexi Time - 25'09'2017 - '20'10'2017 - User: Balance brought forward: 0:00
MorningMid-sessionAfternoon Totals & Credits Day BalanceRunning Balance
DayDateAMAMMidMidPMPM WorkedCreditTotal StdDrCr
Mon25/09/20177:0010:0012:0014:0016:0018:00 7:00 7:00 7:240:24 0.02
Tue26/09/20178:0012:30 13:0017:30 9:00 9:00 7:24 1:36
Wed27/09/20179:0012:00 12:3014:00 4:30 4:30 7:242:54
Thu28/09/20179:0012:00 12:3018:00 8:30 8:30 7:24 1:06
Fri29/09/20178:0010:0011:0014:0014:3018:00 8:30 8:30 7:24 1:06
37:30 37:30 3:183:48
Total Hours37:30
less Standard Hours37:00
Weekly Balance0:30debit
<colgroup><col width="64" style="width: 48pt;"> <col width="42" style="width: 31pt; mso-width-source: userset; mso-width-alt: 1479;"> <col width="79" style="width: 59pt; mso-width-source: userset; mso-width-alt: 2816;"> <col width="63" style="width: 47pt; mso-width-source: userset; mso-width-alt: 2247;" span="6"> <col width="6" style="width: 5pt; mso-width-source: userset; mso-width-alt: 227;"> <col width="63" style="width: 47pt; mso-width-source: userset; mso-width-alt: 2247;" span="3"> <col width="6" style="width: 5pt; mso-width-source: userset; mso-width-alt: 227;"> <col width="63" style="width: 47pt; mso-width-source: userset; mso-width-alt: 2247;" span="4"> <col width="64" style="width: 48pt;"> <tbody> </tbody>
 
Upvote 0


Flexi Time - 25'09'2017 - '20'10'2017 - User:
Balance brought forward:
0:00
Morning
Mid-session
Afternoon
Totals & Credits
Day Balance
Running Balance
Day
Date
AM
AM
Mid
Mid
PM
PM
Worked
Credit
Total
Std
Dr
Cr
Mon
25/09/2017
7:00
10:00
12:00
14:00
16:00
18:00
7:00
7:00
7:24
0:24
0.02
Tue
26/09/2017
8:00
12:30
13:00
17:30
9:00
9:00
7:24
1:36
Wed
27/09/2017
9:00
12:00
12:30
14:00
4:30
4:30
7:24
2:54
Thu
28/09/2017
9:00
12:00
12:30
18:00
8:30
8:30
7:24
1:06
Fri
29/09/2017
8:00
10:00
11:00
14:00
14:30
18:00
8:30
8:30
7:24
1:06
37:30
37:30
3:18
3:48
Total Hours
37:30
less Standard Hours
37:00
Weekly Balance
0:30
debit

<tbody>
</tbody>
 
Upvote 0
The problem is, I'm on a secure network and can't directly upload a file or image.

Ok - the problem is this...

Balance brought forward = 0:00 (this is the starting balance)

Day Balance - std remains static 7:24;

Dr col (K7=worked fig., O7=Std) =IF(K7=0,"",IF(K7=O7,"",IF(K7>O7,"",O7-K7)))

Cr col =IF(K7=0,"",IF(K7=O7,"",IF(K7<O7,"",K7-O7)))

Running balance (P7=Dr; O3=Running balance fig.; Q7=Cr) {=IF(P7="",O3+Q7,IF(Q7="",O3-P7))}

The running balance returns ##### and won't return [h]:mm, when this is corrected I also need to change font colour based on whether the return value is a debit (red) or a credit (green)
 
Upvote 0
can't directly upload a file or image.

Hi, not been asking for either of those.

<o7,"",k7-o7)))
The running balance returns ##### and won't return [h]:mm, when this is corrected I also need to change font colour based on whether the return value is a debit (red) or a credit (green)

Seems the problem you are having is with negative times; maybe you can use the 1904 date system:

https://support.microsoft.com/en-hk...e-value-are-displayed-as-pound-signs-in-excel

Once you get your times displayed the way you want, you can try a custom number format of:

[hh]:mm;[Red][hh]:mm
</o7,"",k7-o7)))
 
Upvote 0
I've encountered another issue - sorry!

How can I format the box for 'balance brought forward' if the value is a negative (debit) balance of hours/mins?
 
Upvote 0

Forum statistics

Threads
1,215,051
Messages
6,122,871
Members
449,097
Latest member
dbomb1414

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