How to sumif values (days worked) to each month, across a range of multiple weeks

mattdale

New Member
Joined
Jun 8, 2023
Messages
2
Office Version
  1. 2011
Platform
  1. MacOS
The top table has weeks sorted into columns, and a count of days allocated to the weeks. The below table lists out months and the formula in the bottom table extracts the days in each of the weeks. The issue arises where there is a part day allocated, as the formula ignores this- it only counts the full days. The difference column in the below table shows the variance which should be zero if the formula was perfect.

Here is the current formula:

=let(Λ,tocol(bycol({$B$1:$V$2;$B3:$V3},lambda(Σ,chooserows(sequence(days(index(Σ,2,),index(Σ,1,))+1,1,Σ,1),sequence(index(Σ,3,))))),1,1),
countif(index(eomonth(Λ,)),eomonth(A$17,)))

Any help would be really appreciated!

All the best
Matt
 

Attachments

  • Screenshot 2023-06-08 at 09.58.34.png
    Screenshot 2023-06-08 at 09.58.34.png
    166.9 KB · Views: 24

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
A few questions:
1) Is it a 5-day (Mon-Fri) work week?
2) Do holidays need to be taken into account?
3) Which version of Excel will you be using? -- LET, BYCOL, LAMBDA, and many other functions are not available in Excel 2011 for MacOS.
 
Upvote 0
A few questions:
1) Is it a 5-day (Mon-Fri) work week?
2) Do holidays need to be taken into account?
3) Which version of Excel will you be using? -- LET, BYCOL, LAMBDA, and many other functions are not available in Excel 2011 for MacOS.
Thanks for the reply, firstly yes it would be a 5 day work week. No holidays wouldn't need to be taken into account. The formula / sheet was actually put together in Googlesheets. If there's one which might work across both that would be amazing. It feels like a relatively simple challenge, although allocating days to weeks, then months has proved a little trickier than first thought! Any tips / guidance / opinion on whether it's possible would be really appreciated? Also looking potentially for a professional consultant for this and a few other spreadsheet challenges.
 
Upvote 0
See if the following formula works for you:
Excel Formula:
=SUM(BYCOL($B$1:$V$2,LAMBDA(a,MAX(0,NETWORKDAYS(MAX(CHOOSEROWS(a,1),B$17),MIN(CHOOSEROWS(a,2),EOMONTH(B$17,0))))))*$B3:$V3/5)
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,327
Members
452,635
Latest member
laura12345

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