Using a Formula To Determine A Task's Cost Allocation Per Week Based On a Task's Start and End Date

%3CLINGO-SUB%20id%3D%22lingo-sub-1889062%22%20slang%3D%22en-US%22%3EUsing%20a%20Formula%20To%20Determine%20A%20Task's%20Cost%20Allocation%20Per%20Week%20Based%20On%20a%20Task's%20Start%20and%20End%20Date%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1889062%22%20slang%3D%22en-US%22%3E%3CP%20class%3D%22_1qeIAgB0cPwnLhDF9XSiJM%22%3EHello%20Everyone%2C%3C%2FP%3E%3CP%20class%3D%22_1qeIAgB0cPwnLhDF9XSiJM%22%3EI%20need%20help%20generating%20a%20formula%20that%20can%20do%20the%20following%3A%3C%2FP%3E%3CP%20class%3D%22_1qeIAgB0cPwnLhDF9XSiJM%22%3EDetermine%20how%20many%20task%20working%20days%20(Mon-Fri)%20there%20are%20given%20a%20task's%20start%20and%20end%20date.%20Out%20of%20those%20days%2C%20determine%20how%20many%20of%20those%20days%20there%20are%20in%20a%20designated%20week's%20date%20range%2C%20if%20any.%20Then%20take%20the%20task's%20budgeted%20cost%20and%20divide%20it%20by%20the%20total%20number%20of%20working%20days%20and%20multiply%20the%20cost%20per%20day%20by%20the%20designated%20number%20of%20working%20days%20in%20the%20corresponding%20week%20(if%20any)%20to%20get%20the%20cost%20per%20week.%3C%2FP%3E%3CP%20class%3D%22_1qeIAgB0cPwnLhDF9XSiJM%22%3EExample%3A%3C%2FP%3E%3CP%20class%3D%22_1qeIAgB0cPwnLhDF9XSiJM%22%3EGiven%20Task%20As%20start%20Date%20range%20of%2011%2F9%2F20-11%2F17%2F20%2C%20there%20are%20a%20total%20of%207%20working%20days.%3CBR%20%2F%3EThe%20cost%20of%20task%20A%20is%20%2410%2C000.%20%2410%2C000%2F7%20days%20%3D%20%241%2C428.57%20per%20day%3C%2FP%3E%3CP%20class%3D%22_1qeIAgB0cPwnLhDF9XSiJM%22%3EIn%20Week%201's%20range%20of%2011%2F9%2F20-11%2F15%2F20%2C%20task%20A%20has%205%20working%20days.%20Week's%201%20allocation%20would%20equal%20%241%2C428.57%20*%205%20%3D%20%247%2C142.85%3CBR%20%2F%3EIn%20week%202's%20range%20of%2011%2F16%2F20-11%2F22%2F20%2C%20task%20A%20has%202%20working%20days.%20Week's%202%20allocation%20would%20equal%20%241%2C428.57%20*%202%20%3D%20%242%2C857.14%3CBR%20%2F%3EIn%20week%203's%20range%20of%2011%2F23%2F20-11%2F29%2F20%2C%20task%20A%20has%200%20working%20days.%20Week%203's%20allocation%20would%20equal%20%240.%3CBR%20%2F%3E...etc.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1889062%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1889645%22%20slang%3D%22en-US%22%3ERe%3A%20Using%20a%20Formula%20To%20Determine%20A%20Task's%20Cost%20Allocation%20Per%20Week%20Based%20On%20a%20Task's%20Start%20and%20End%20D%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1889645%22%20slang%3D%22en-US%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F869790%22%20target%3D%22_blank%22%3E%40dmartin215%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EPlease%20find%20below%20construction%20of%20the%20formula%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-applescript%22%3E%3CCODE%3E%3DROUND(%24B4%2FNETWORKDAYS.INTL(%24C4%2C%24D4%2C1)%2C2)*SUM(--(IF(WEEKDAY((C4%2BROW(%24A%241%3AINDIRECT(%22A%22%26amp%3B(%24D4-%24C4)%2B1%2CTRUE))-1)%2C2)%26lt%3B%3D5%2CINDEX(%24A%2410%3A%24A%2415%2CMATCH((%24C4%2BROW(%24A%241%3AINDIRECT(%22A%22%26amp%3B(%24D4-%24C4)%2B1%2CTRUE))-1)%2C%24B%2410%3A%24B%2415%2C1))%2C0)%3DE%243))%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Snag_37e78062.png%22%20style%3D%22width%3A%20641px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F233698i31C44D0694D41871%2Fimage-dimensions%2F641x271%3Fv%3D1.0%22%20width%3D%22641%22%20height%3D%22271%22%20role%3D%22button%22%20title%3D%22Snag_37e78062.png%22%20alt%3D%22Snag_37e78062.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%E2%80%83%3C%2FP%3E%3CP%3E%3CSPAN%3ERegards%2C%20Faraz%20Shaikh%20%7C%20MCT%2C%20MIE%2C%20MOS%20Master%2C%20Excel%20Expert%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CEM%3E%3CFONT%20color%3D%22%23808080%22%3EIf%20you%20find%20the%20above%20solution%20resolved%20your%20query%20don't%20forget%20mark%20as%26nbsp%3B%3CSPAN%3EOfficial%2FBest%20Answer%20%26amp%3B%20like%20it%20to%20help%20the%20other%20members%20find%20it%20more.%3C%2FSPAN%3E%3C%2FFONT%3E%3C%2FEM%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1898416%22%20slang%3D%22en-US%22%3ERe%3A%20Using%20a%20Formula%20To%20Determine%20A%20Task's%20Cost%20Allocation%20Per%20Week%20Based%20On%20a%20Task's%20Start%20and%20End%20D%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1898416%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F156456%22%20target%3D%22_blank%22%3E%40Faraz%20Shaikh%3C%2FA%3E%26nbsp%3BNice%20formula!!%20Thank%20you%20sir.%20Per%20the%20picture%20it%20appears%20the%20first%20value%20(%247%2C142)%20is%20correct%2C%20however%20when%20I%20open%20the%20file%20it%20reverts%20to%20%249%2C999.%20And%20for%20task%20B%2C%20the%20value%20for%20both%20week%203%20and%204%20should%20be%20%246%2C000.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
New Contributor

Hello Everyone,

I need help generating a formula that can do the following:

Determine how many task working days (Mon-Fri) there are given a task's start and end date. Out of those days, determine how many of those days there are in a designated week's date range, if any. Then take the task's budgeted cost and divide it by the total number of working days and multiply the cost per day by the designated number of working days in the corresponding week (if any) to get the cost per week.

Example:

Given Task As start Date range of 11/9/20-11/17/20, there are a total of 7 working days.
The cost of task A is $10,000. $10,000/7 days = $1,428.57 per day

In Week 1's range of 11/9/20-11/15/20, task A has 5 working days. Week's 1 allocation would equal $1,428.57 * 5 = $7,142.85
In week 2's range of 11/16/20-11/22/20, task A has 2 working days. Week's 2 allocation would equal $1,428.57 * 2 = $2,857.14
In week 3's range of 11/23/20-11/29/20, task A has 0 working days. Week 3's allocation would equal $0.
...etc.

2 Replies

Hi @dmartin215 

 

Please find below construction of the formula

 

 

=ROUND($B4/NETWORKDAYS.INTL($C4,$D4,1),2)*SUM(--(IF(WEEKDAY((C4+ROW($A$1:INDIRECT("A"&($D4-$C4)+1,TRUE))-1),2)<=5,INDEX($A$10:$A$15,MATCH(($C4+ROW($A$1:INDIRECT("A"&($D4-$C4)+1,TRUE))-1),$B$10:$B$15,1)),0)=E$3))

 

 

Snag_37e78062.png

Regards, Faraz Shaikh | MCT, MIE, MOS Master, Excel Expert

If you find the above solution resolved your query don't forget mark as Official/Best Answer & like it to help the other members find it more.

@Faraz Shaikh Nice formula!! Thank you sir. Per the picture it appears the first value ($7,142) is correct, however when I open the file it reverts to $9,999. And for task B, the value for both week 3 and 4 should be $6,000.