# Creating a rolling sum function

#### stugale

##### New Member
Hi everyone,I am trying to create a spread sheet that adds up my staff's hours worked for a rolling 119 day period, sounds easy but I have to ignore any day that they have taken as leave but still include a 119 day period. For example if I had a member of staff who took 6 days off in that 119 day period I would need to add in the extra 6 days at the end, so I would need a 125 day period to be calculated.Is this possible? At the moment I have the rolling 119 day sum and a countif to tell me how many days leave (input as L) and then I manually add the extra cells to the formula. So my formula reads =SUM(C2:DQ2)+SUM(DR2:DW2) as my employee has taken 6 days leave. Many ThanksStu

### Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
L

#### Legacy 421546

##### Guest
Well, where is the leave count? Just add that to the sum

#### stugale

##### New Member
I have the leave count in row 3, so I have a rolling 119 day period of leave as well, but I'm not sure how to automatically adjust the formula to include the extra days. I have 45 members of staff so I'm looking for a way to automatically calculate the rolling number of hours worked rather than having the simple total and having to manually adjust the formula for every leave day.

#### stugale

##### New Member
Dummy example of what I'm trying to achieve -

 Staff # Name 01-Jul 02-Jul 03-Jul 04-Jul 05-Jul 1 Jones 10 10 0 L 10

<tbody>
</tbody>

say I need to calculate a 4 day rolling sum of hours Jones would be 20 hours but because he had a leave day I need to do a 5 day rolling sum to account for his leave day. Therefore his total would be 30 hours. I need to expand this to cover 119 day period so not as easy as just looking and amending.

Thank You

Replies
5
Views
69
Replies
1
Views
412
Replies
1
Views
225
Replies
1
Views
253
Replies
0
Views
65

Threads
1,127,832
Messages
5,627,152
Members
416,224
Latest member
RichardHell

### 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

### 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