Calculate Business day based on multiple criteria

nikhil0311

Board Regular
Joined
May 3, 2013
Messages
200
Office Version
  1. 2013
Platform
  1. Windows
DateHolidayBusiness Day
Friday, November 1, 2019No1
Monday, November 4, 2019Yes-
Tuesday, November 5, 2019No2
Tuesday, November 5, 2019No2
Tuesday, November 5, 2019No2
Wednesday, November 6, 2019Yes-
Thursday, November 7, 2019No4
Friday, November 8, 2019No5
Monday, November 11, 2019No6
Tuesday, November 12, 2019No7
Wednesday, November 13, 2019No9
Monday, December 2, 2019No1
Tuesday, December 3, 2019Yes-
Wednesday, December 4, 2019Yes-
Thursday, December 5, 2019No2
Friday, December 6, 2019No3
Monday, December 9, 2019No4
In column A we have dates. We have instances where the same date have multiple entries
Column B we have Holiday Status as Yes or No.
Based on below criteria, we have to calculate Business day in column C
The starting day of every month should be BD = 1
If we have duplicate date then the BD should repeat. For example in row 5 and 6 we have the same date i.e. 5th november so the business day should be the same for both dates
If Holiday is equals to "Yes" then BD sahould be "-". And Business day should continue to be in line with above i.e. for date 1st Nov BD is 1, 4thNov holiday = Yes so BD is "-" and then 5th Nov BD should be 2

please refer the final BD in column C
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
You need to make sure that your dates are formatted correctly.

VBA Code:
=IF(B1="Yes","-",IF(WEEKDAY(A1,2)< 6,NETWORKDAYS(A1-DAY(A1)+1,A1),"Weekend"))
 
Upvote 0
Try the following array formula (to be entered using Ctrl+Shift+Enter, not just Enter):

=IF(OR(B2="Yes",WEEKDAY(A2,2)>5),"-",NETWORKDAYS(EOMONTH(A2,-1)+1,A2,IF($B$2:$B$18="Yes",$A$2:$A$18,0)))
 
Upvote 0

Forum statistics

Threads
1,223,981
Messages
6,175,771
Members
452,668
Latest member
mrider123

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