Contractual Weeks Calculation

August

Active Member
Joined
Jun 18, 2004
Messages
281
Office Version
  1. 365
Platform
  1. Windows
In the attached a contractual week starts at the first work day marked x and ends 7days later. The next contractual week starts on the next work day marked x and end 7 days later. The final contractual week can have less than 7 days. The No of contractual weeks for Harry would therefore be 3.
I have tried many variants of sumproducts/countifs/mod but cannot get a formula that works.
Does anyone have an idea how I could achieve the corrrect result in a formula

Many thanks
 

Attachments

  • ContWeeks.png
    ContWeeks.png
    24.8 KB · Views: 24
... Is there a way to use "SW", "W", "WF" and "SWF" in the code as these are the markers to denote days worked...
This can be done by modifying the IIf function in the VBA code to explicitly mention all your tags:
VBA Code:
... IIf(cll = "SW" Or cll = "W" Or cll = "WF" Or cll = "SWF", "x", " ") ...
or to treat cells with any text in them as a worked days:
VBA Code:
... IIf(cll <> "", "x", " ") ...
 
Upvote 0
Solution

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
This can be done by modifying the IIf function in the VBA code to explicitly mention all your tags:
VBA Code:
... IIf(cll = "SW" Or cll = "W" Or cll = "WF" Or cll = "SWF", "x", " ") ...
or to treat cells with any text in them as a worked days:
VBA Code:
... IIf(cll <> "", "x", " ") ...
 
Upvote 0
Thank you so much for this
I can't tell you how helpful this will be
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,241
Members
452,622
Latest member
Laura_PinksBTHFT

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