Formula for Counting Days based on 2 Scenarios

ExcelEndeavor

New Member
Joined
Oct 13, 2020
Messages
11
Office Version
  1. 365
Platform
  1. MacOS
I have a timeline that has a user input the start date and the number of days for each task to be completed, which will generate a completion date. Here's where it gets confusing -

For tasks that take 5 days or less, I CAN'T count weekend days or holidays.
For tasks that take 6 days or more, I CAN count weekend days and holidays, but the completion date CAN'T land on a weekend day or holiday.

The screenshot below shows the start date in blue (G7) and the number of days in blue (C8,C9,C10), the result will populate the red dates. The blue cells are user inputs, so they will be varied. The list of holidays is listed at E29:E38.


Tasks.jpg



I have two formulas that are working great so far:

For tasks that take 5 days or less, I am using:

=IF(G7="","",WORKDAY(G7,C9,E29:E38))

For tasks that take 6 days or more, I am using:

=IF(G7="","",IF(WEEKDAY(G10)=7,WORKDAY(G10,1,E29:E38),IF(WEEKDAY(G10)=1,WORKDAY(G10,1,E29:E38),WORKDAY(G10-1,1,E29:E38))))


Sometimes tasks might take longer than the 2 day or 5 day examples that I have in the screenshot. Is there a way to combine these formulas into one, so when the user inputs the number of days less than 5 or more than 6, it will automatically count the correct days and holidays?

Thank you in advance.
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Maybe

=IF($G$7="","",IF(C9<6,WORKDAY($G$7,C9,$E$29:$E$38),WORKDAY($G$7+C9-1,1,$E$29:$E$38)))
 
Upvote 0

Forum statistics

Threads
1,214,786
Messages
6,121,553
Members
449,038
Latest member
Guest1337

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