Sum Values if weekday

Nitrousoxide

New Member
Joined
Feb 27, 2018
Messages
2
I'm trying to create a function that sums the amount of time people worked on a project every week day (but not weekends).

Basically I have a set of data like this:


<style type="text/css"><!--td {border: 1px solid #ccc;}br {mso-data-placement:same-cell;}--></style>
Number of days since start of project1.002.003.004.005.00WeekendWeekend6.00
Date2/12/182/13/182/14/182/15/182/16/182/17/182/18/182/19/18
Hours
Billcode 100000000
Billcode 25060302522281025
Billcode 313462002
Billcode 411354102
Billcode 502138007
Billcode 600000000

<colgroup><col style="width: 236px"><col width="100"><col width="100"><col width="100"><col width="100"><col width="100"><col width="100"><col width="100"><col width="100"></colgroup><tbody>
</tbody>


I want to add up the values for say bill codes 3-6 and divide by the number of weekdays the project has been going on and have a running average number of hours billed each weekday those sets of bill codes combined.

At the start of each day I'll be dropping in the amount of hours billed for the previous day in the right most column, so ideally the function would update every day to give a new average, unless the new day that was added was a weekend day.

Any ideas on how to do this?

I've come up with a way to do this for a 5 day average like this:

=sum(index(1:12,12, match((NETWORKDAYS(B2,today()-1)-0),1:1,0)),index(1:12,12, match((NETWORKDAYS(B2,today()-1)-1),1:1,0)),index(1:12,12, match((NETWORKDAYS(B2,today()-1)-2),1:1,0)),index(1:12,12, match((NETWORKDAYS(B2,today()-1)-3),1:1,0)),index(1:12,12, match((NETWORKDAYS(B2,today()-1)-4),1:1,0)))/5


But obviously something like that doesn't work for a dataset that will constantly be growing.
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.

Forum statistics

Threads
1,214,974
Messages
6,122,536
Members
449,088
Latest member
RandomExceller01

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