Need help calculating overtime to date

B

BVHis

So here's the deal... I need to calculate the total number of overtime
hours to date. I've searched the threads but have come up short with
what I need to accomplish.

My spreadsheet has a TOTAL OVERTIME cell (A5). Cells B5 through BA5
represent the 52 weeks in a year. Each time a value is entered in any
of those cells, I would like the TOTAL OVERTIME value to update
(overtime is anything over 40 hours). So if 41 is entered in B5, the
total overtime to date would be 1. If 44 is entered in C5, the total
overtime to date would be 5 hours (1 hour from the previous week and 4
hours from this week).

This is the formula I found, but this only does one 40 hour period. I
need something a little more complex.

=IF(A5>=40,SUM(A5-40),"0")

Thanks in advance!

Matt W
 
S

SteveG

=SUMPRODUCT(--(B5:BA5>40),--(B5:BA5))-SUMPRODUCT(--(B5:BA5>40))*40

or

=SUMPRODUCT(--(B5:BA5>40),--(B5:BA5))-COUNTIF(B5:BA5,">40")*40

HTH

Steve
 
R

Roger Govier

Hi

One way
=SUM(B5:BA5)-COUNTIF(B5:BA5,">0")*40

Basically, add all the hours in the range then deduct 40 times the
number of weeks that have data within them (>0).
 
J

John Michl

This seems to work. It is an array formula so you must use
Ctrl-Shift-Enter to commit it.

{=SUM(IF(B5:BA5>40,B5:BA5-40),0)}

(Note the { } symbols are not entered but are automatically inserted
when you commit with Ctrl-Shift-Enter.)

- John
www.JohnMichl.com
 
J

John Michl

This assumes that the minimum number of hours worked is 40. If someone
worked 39 hours in a week, the total would not be correct.
 
R

Roger Govier

You're quite right, John, my argument is flawed.
Your's, and the other solutions posted will solve the OP's problem
without the error that mine would potentially have had.
 

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