Running total with conditions

PrincessColumbia

New Member
Joined
Sep 22, 2015
Messages
23
So I'm putting together a spreadsheet for calculating hours for a paycheck and I've run into an issue generating a running total to calculate overtime.

Here's my columns:
  • Date (One row per day worked)
  • Week number
  • Hours worked (this is where the data gets entered, everything else is calculated)
  • Running total hours for the week
  • Base hours
  • Overtime hours
  • Base rate (manually entered, but doesn't change much)
  • Overtime rate (calculated based on Base Rate)
  • Base pay
  • Overtime pay
  • Total pay

So the process I'm trying to do should be, "If the total hours so far for this week are more than 40, then take all the hours above 40 and put them in the overtime column. Otherwise, just add the time to the Base Hours column."

My major logjam on this is the Running Total Hours for the Week. The formula I'm attempting is this:
Code:
=SUMIFS(INDEX([Hours worked],1):[@[Hours Worked]]),[Week Number],[@[Week Number])

As written, it produces an error. If I just do the INDEX formula, it does a running total of the "Hours Worked" column no problem, but naturally that doesn't help me with just the week.

Any help?
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
=SUMIF([Week Number],[@Week Number],[Hours Worked])
 
Upvote 0
Perhaps something like this:

Base: =[@Hours]-[@Overtime]
Overtime: =MEDIAN(0,[@Hours],SUM(INDEX([Hours],MATCH([@WeekNo],[WeekNo],)):[@Hours])-40)


Excel 2010
ABCDE
1WeekNoDayHoursBaseOvertime
2109 Oct 20178.08.00
3110 Oct 201712.512.50
4111 Oct 201710.010.00
5112 Oct 20179.09.00
6113 Oct 20178.00.57.5
7216 Oct 20178.08.00
8217 Oct 20178.08.00
9218 Oct 201715.015.00
10219 Oct 201712.59.03.5
11220 Oct 20178.00.08
Sheet1
 
Last edited:
Upvote 0
running total: =SUMIF(INDEX([Week Number],1):[@Week Number],[@Week Number],INDEX([Hours worked],1):[@Hours worked])
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,178
Members
453,021
Latest member
Justyna P

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