I have a table that has 4 columns: Start Time (A), End Time (B), Regular (C), and Overtime (D). I want columns C and D to be automatically populated based on what is entered in A and B. Here's the formula I have in cell C (assume row 1)
C1 = (hour(B1) + (minute(B1) / 60)) - (hour(A1) + (minute(A1) / 60))
This produces the correct result. Next I want to subtract .5 for a lunch break if C1 >= 8. This is how I do it.
C1 = if( ((hour(B1) + (minute(B1) / 60)) - (hour(A1) + (minute(A1) / 60)))
>= 8, (((hour(B1) + (minute(B1) / 60)) - (hour(A1) + (minute(A1) / 60)) - .5), = ((hour(B1) + (minute(B1) / 60)) - (hour(A1) + (minute(A1) / 60)) )
There's gotta be an easier way to write this. Perhaps assign an arbitrary cell the first forumla and use it in cell C?
cell Z1 = (hour(B1) + (minute(B1) / 60)) - (hour(A1) + (minute(A1) / 60))
cell C1 = if(Z >= 8, Z - .5, Z)
Then, I want to fill in cell D based on the results of cell C if C >= 8.
D1 = if((C1 - 8) >= 0, (C1 - 8), 0)
As I type, I'm slowing discovering solutions. Although, I'm still having an issue when inserting a new row. I thought that Excel uses relative formulas by default, meaning that as the cells change, so does the formula to accommodate. For instance, if I insert a new row, 2, I would expect the formula in the cell in row 2 to correspond to thos cell (ie. D2 = if((C2 - 8) >= 0, (C2 - 8), 0)). However, the formulas seem to be absolute as they don't change as I insert new rows; if fact, they are empty!
So I suppose my questions are:
A) How can I simplify these formulas?
B) How can I ensure newly inserted rows contain relative formulas?
-Geates
"I hope I can chill and see the change - stop the bleed inside and feel again. Cut the chain of lies you've been feeding my veins; I've got nothing to say to you!"
-Infected Mushroom
"I do not offer answers, only considerations."
- Geates's Disclaimer
C1 = (hour(B1) + (minute(B1) / 60)) - (hour(A1) + (minute(A1) / 60))
This produces the correct result. Next I want to subtract .5 for a lunch break if C1 >= 8. This is how I do it.
C1 = if( ((hour(B1) + (minute(B1) / 60)) - (hour(A1) + (minute(A1) / 60)))
>= 8, (((hour(B1) + (minute(B1) / 60)) - (hour(A1) + (minute(A1) / 60)) - .5), = ((hour(B1) + (minute(B1) / 60)) - (hour(A1) + (minute(A1) / 60)) )
There's gotta be an easier way to write this. Perhaps assign an arbitrary cell the first forumla and use it in cell C?
cell Z1 = (hour(B1) + (minute(B1) / 60)) - (hour(A1) + (minute(A1) / 60))
cell C1 = if(Z >= 8, Z - .5, Z)
Then, I want to fill in cell D based on the results of cell C if C >= 8.
D1 = if((C1 - 8) >= 0, (C1 - 8), 0)
As I type, I'm slowing discovering solutions. Although, I'm still having an issue when inserting a new row. I thought that Excel uses relative formulas by default, meaning that as the cells change, so does the formula to accommodate. For instance, if I insert a new row, 2, I would expect the formula in the cell in row 2 to correspond to thos cell (ie. D2 = if((C2 - 8) >= 0, (C2 - 8), 0)). However, the formulas seem to be absolute as they don't change as I insert new rows; if fact, they are empty!
So I suppose my questions are:
A) How can I simplify these formulas?
B) How can I ensure newly inserted rows contain relative formulas?
-Geates
"I hope I can chill and see the change - stop the bleed inside and feel again. Cut the chain of lies you've been feeding my veins; I've got nothing to say to you!"
-Infected Mushroom
"I do not offer answers, only considerations."
- Geates's Disclaimer