Trying to work out a formula for time lost/gained

L

Laurr456

Hello, I'm not a complete novice when it comes to excel but I dont hav
much experience with anything other than simple formulas...

This is a bit tricky to explain but i'll try my best...

I'm trying to devise a table to highlight time lost or gained in
single day.

1. In the first column I want the amount of time worked (in hours an
minutes)
2. In the second, if the time worked exceeds 7hrs 24mins then I woul
like the aditional time to show (e.g if worked 8hrs 34mins I would lik
1hr 10mins to show, preferably as 1:10)
3. In the third, if the time worked is less than 7hrs 24mins. I woul
like the time lost to show


Any help is appreciated as all i've managed to do it get it to show th
time worked or 0 in the 2nd and 3rd colums.

TI

+-------------------------------------------------------------------
+-------------------------------------------------------------------
 
C

Claus Busch

Hi,

Am Mon, 13 Aug 2012 14:37:14 +0000 schrieb Laurr456:
1. In the first column I want the amount of time worked (in hours and
minutes)
2. In the second, if the time worked exceeds 7hrs 24mins then I would
like the aditional time to show (e.g if worked 8hrs 34mins I would like
1hr 10mins to show, preferably as 1:10)
3. In the third, if the time worked is less than 7hrs 24mins. I would
like the time lost to show

in B2:
=IF(A2<TIME(7,24,),TIME(7,24,)-A2,"")
in C2:
=IF(A2<TIME(7,24,),TIME(7,24,)-A2,"")



Regards
Claus Busch
 
C

Claus Busch

Hi,

Am Mon, 13 Aug 2012 21:56:11 +0200 schrieb Claus Busch:
in B2:
=IF(A2<TIME(7,24,),TIME(7,24,)-A2,"")
in C2:
=IF(A2<TIME(7,24,),TIME(7,24,)-A2,"")

sorry, I copied one formuala twice
in B2:
=IF(A2>TIME(7,24,),A2-TIME(7,24,),"")
in C2:
=IF(A2<TIME(7,24,),TIME(7,24,)-A2,"")


Regards
Claus Busch
 
L

Laurr456

Wow, thank you both so much - problem solved!! :

+-------------------------------------------------------------------
+-------------------------------------------------------------------
 
S

Spencer101

Laurr456;1604602 said:
Ok...now i've done that, I have another query.

I've had to add a 4th column (F) which is a running balance. Th
starting balance is a minus figure (-12).

Which formula can I use which will alter the balance per day, dependin
on whether there is a credit in the 2nd column (D) or a debit in the 3r
(E)

Hope this makes sense.

Thanks again

Could you post an example of your sheet so far

+-------------------------------------------------------------------
+-------------------------------------------------------------------
 
L

Laurr456

I'm using Office 2003.

Thanks for the reply - I have managed to get the credit/debit part of m
sheet working, now i'm just bamboozled by the running balance part..a
it starts with a minus figure.

I need to know how to make it so when I have a credit the balance goe
down and a debit makes the balance go up..

+-------------------------------------------------------------------
+-------------------------------------------------------------------
 
J

joeu2004

Laurr456 said:
I have managed to get the credit/debit part of my
sheet working, now i'm just bamboozled by the running
balance part..as it starts with a minus figure.
I need to know how to make it so when I have a credit
the balance goes down and a debit makes the balance
go up..?

Referring to http://www.excelbanter.com/attachment.php?attachmentid=541,
which you mention in another posting in this thread....

That will be easy. But first, you need to tell us:


1. What are the units of -12.00? Hours? The values in the credit and debit
are Excel times (hh:mm). But -12.00 is a decimal number.


2. Should the -12.00 be on a line by itself before the first line of data.
That is, after line 2, but before line 3? Otherwise, I can we subtract/add
the first credit/debit?


Assuming -12.00 represents hours, it is in J3, and the data starts in row 4,
the formula in J4 might be:

=J3 + IF(H4<>"",H4*24,IF(I4<>"",-I4*24,0))


Some other observations:


3. The formula in G3 is =SUM(F3-D3-E3). There is no point in using the SUM
function there. Simply write =F3-D3-E3.

However, I think it would be prudent to write =--TEXT(F3-D3-E3,"hh:mm"),
since you compare values in column G with "constant" times of the form
TIME(7,24,0).

The double-negative (--) converts text to numeric time. The TEXT function
effectively rounds to the minute. It is necessary to eliminate arithmetic
anomalies that creep into Excel computations. These cause infinitesimal
differences with equivalent constants. So theoretically at least, it is
possible for G3 to display as 7:24, but G3>TIME(7,24,0) or G3<TIME(7,24,0)
might be true.


4. I would write TIME(7,24,0) instead of TIME(7,24,). I know: the two are
equivalent. But IMHO, it is error-prone to omit seconds in that manner. In
fact, it seems to be an accident of implementation that the omission is
interpreted as zero. I do not see that allowed in the TIME help page. I
know it's not your "mistake".
 
J

joeu2004

Errata.... I said:
Assuming -12.00 represents hours, it is in J3, and the
data starts in row 4, the formula in J4 might be: =J3 +
IF(H4<>"",H4*24,IF(I4<>"",-I4*24,0))

Just notice that you have a "break" -- a blank row between weeks. To make
it easy to copy the formula down, do the following:

=IF(G4="","",IF(J3="",J2,J3)+IF(H4<>"",H4*24,IF(I4<>"",-I4*24,0)))
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top