Hi lyroj,
=B2-(B3+SUMPRODUCT(--(WEEKDAY(ROW(INDIRECT(B2-B3&":"&B2)))=1))+SUMPRODUCT(--ISNUMBER(MATCH($D$2:$D$7,ROW(INDIRECT(B2-B3&":"&B2)),0))))
ROW(INDIRECT(B2-B3&":"&B2)) -> Since Excel stores dates as numbers, the INDIRECT function used with the ROW function creates an array of numbers from End Date - No. of days to End Date. Since this is used in SUMPRODUCT, and SUMPRODUCT accepts arrays, we don't have to enter this as an array formula.
The range of numbers when used with the WEEKDAY function gives another range of numbers 1-7. This is equated with 1 (for Sundays). This results in an array of TRUE/FALSE (True for Sundays and False for other days).
The -- but coerces the TRUE/FALSE to 1/0. SUMPRODUCT then gives the sum of the range = no. of Sundays that occur within the date range End Date - No. of days to End Date.
Similarly
MATCH($D$2:$D$7,ROW(INDIRECT(B2-B3&":"&B2)),0) where D2:D7 contains the holiday list matches the holiday list against the date range, returning the position in the array (if match occurs) and an error (if there is no match). The ISNUMBER part converts this array to an array of TRUE/FALSE for when matches are present and when they are not. -- once again coerces TRUE/FALSE to 1/0 and SUMPRODUCT returns the number of days from the holiday list that occur in the date range End Date - No. of days to End Date.
These two numbers are added to No. of days and the total is subtracted from End date resulting in the start date.
Hope this helps.