2 Sets of holiday ranges NETWORKDAYS

All2Cheesy

Board Regular
Joined
Mar 4, 2015
Messages
127
Hi All,

Is it possible to set two sets of holiday ranges when writing a network days function?
Below is my current formula:

Code:
=IFERROR(NETWORKDAYS(C2,M2,LARGE((W2,X2),ROW(INDIRECT("1:"&ROWS(W2)+ROWS(X2)))))-1,"")

W2 and X2 refer to cell ranges.

Assistance would be greatly appreciated. Thank you.
 
Awesome, thanks for that.

I'll give that a go the next time I get a bit of time. (Some new projects at work have come up).
For now I've just set a temporary fix by highlighting any holiday dates via conditional formatting.
 
Upvote 0

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
You haven't answered Aladin's question, but it looks like W2 and X2 refer to two different ranges of cells. If so, your original formula can be changed to the following...

=IF(COUNT(W2,X2)>0,NETWORKDAYS(C2,M2,LARGE((W2,X2),ROW(INDIRECT("1:"&COUNT(W2)+COUNT(X2))))),NETWORKDAYS(C2,M2))

...confirmed with CONTROL+SHIFT+ENTER.
 
Last edited:
Upvote 0
You haven't answered Aladin's question, but it looks like W2 and X2 refer to two different ranges of cells. If so, your original formula can be changed to the following...

=IF(COUNT(W2,X2)>0,NETWORKDAYS(C2,M2,LARGE((W2,X2),ROW(INDIRECT("1:"&COUNT(W2)+COUNT(X2))))),NETWORKDAYS(C2,M2))

...confirmed with CONTROL+SHIFT+ENTER.

Interesting concatenation of arrays. :)

However, it looks like you omitted a bunch of INDIRECTs.
My suggestion would be to define names W_2 as =INDIRECT(W2) and X_2 as =INDIRECT(X2), and adjust your array formula to:
Code:
=IF(COUNT(W_2,X_2)>0,NETWORKDAYS(C2,M2,LARGE((W_2,X_2),ROW(INDIRECT("1:"&COUNT(W_2)+COUNT(X_2))))),NETWORKDAYS(C2,M2))
 
Last edited:
Upvote 0
Hi Marcel,

Actually, I thought those were named ranges. But it looks like those two cells, W2 and X2, likely contain strings that refer to ranges, since one cannot have a cell address as a name for a range. If those two cells do contain strings that refer to ranges, then yeah, INDIRECT would be needed, as you've already indicated.

Thanks for pointing that out!

Cheers!
 
Upvote 0

Forum statistics

Threads
1,216,095
Messages
6,128,790
Members
449,468
Latest member
AGreen17

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