Formula to identify the number of days per month (incl & excl UK bank holidays).

Hakunabrotata

New Member
Joined
Jul 6, 2022
Messages
12
Office Version
  1. 365
  2. 2021
Platform
  1. Windows
Hi all,

I was wondering if anyone could help me with a formula to determine:

-The number of days in a month (option to exclude UK Bank holidays)

-How many different days there were in that month (4 x mondays, 4 x tuesdays, 5 x wednesdays etc). Also.if there is the option to excluce UK Bank holidays, that would be great.

Essentially the source cell would just be your basic 'July-2024'.

Any help would be greatly appreciated.
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
The basic formula (I expect you need workingdays) would be (and the date 1st July 2024 is in A1 - make sure it's a date, not just text which only looks like a date):
Excel Formula:
=NETWORKDAYS(A1,EOMONTH(A1,0),[range_of_cells_containing_UK_bank_holidays])
If you think of all days (including weekends) then
Excel Formula:
=EOMONTH(A1,0)-A1+1
and including weekends, but excluding bank holidays
Excel Formula:
=EOMONTH(A1,0)-A1+1-COUNTIFS([range_of_cells_containing_UK_bank_holidays],"<=" & EOMONTH(A1,0),[range_of_cells_containing_UK_bank_holidays],">=" & A1)
Number of Mondays:
Excel Formula:
=SUM(--(WEEKDAY(SEQUENCE(EOMONTH(A1,0)-A1+1, , A1), 2)=1))
Tuesdays:
Excel Formula:
=SUM(--(WEEKDAY(SEQUENCE(EOMONTH(A1,0)-A1+1, , A1), 2)=2))
(changed last comparision only), etc.
Mondays but not Bank Holidays
Excel Formula:
=LET(MyDays,SEQUENCE(EOMONTH(A1,0)-A1+1,,A1),SUM((WEEKDAY(MyDays,2)=1)*NOT(COUNTIF([range_of_cells_containing_UK_bank_holidays],MyDays))))
PS. [range_of_cells_containing_UK_bank_holidays] in all above formulas is just an address range in a sheet, like: Sheet2!G1:$G$11 or similar
 
Upvote 0
Another option
Fluff.xlsm
ABCDEFGH
101/07/2024Holidays
2Total 23Mon 5Tue 5Wed 5Thu 4Fri 401/01/2024
329/03/2024
401/04/2024
506/05/2024
627/05/2024
726/08/2024
825/12/2024
926/12/2024
Sheet6
Cell Formulas
RangeFormula
A2:F2A2=LET(hols,H2:H13,d,WORKDAY(A1,SEQUENCE(NETWORKDAYS(A1,EOMONTH(A1,0),hols),,0),hols),w,WEEKDAY(d,2),HSTACK("Total "&ROWS(d),MAP({"Mon","Tue","Wed","Thu","Fri"},SEQUENCE(,5),LAMBDA(x,y,x&" "&SUM(--(w=y))))))
Dynamic array formulas.
 
Upvote 0
=LET( e, EOMONTH( A1, 0 ), hol, H2:H13,
dys, VSTACK( NETWORKDAYS.INTL( A1, e, 1, hol ), NETWORKDAYS.INTL( A1, e, REPLACE( "1111111", SEQUENCE( 5 ), 1, 0 ), hol )),
HSTACK( {"TOT";"Mon";"Tue";"Wed";"Thu";"Fri"}, dys )
)
 
Upvote 0

Forum statistics

Threads
1,221,525
Messages
6,160,326
Members
451,637
Latest member
hvp2262

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