I'm having a bit of trouble with
HDays=MMULT(IF(ISNUMBER(HDays_1),HDays_1,0),{1\0})+MMULT(IF(ISNUMBER(HDays_2),HDays_2,0),{0\1})
Can I get a bit of a run through of it?
Sure. first of all I hope it is working with you and your trouble is just about understanding the formula.
In case it doesn't work with you, you might need to adjust the delimiter \ to , or ; or | (I'm not sure: it depends on international settings).
As already explained: Basically a matrix HDays is built with the number of rows equal to the largest range of holidays (MaxRows) and 2 columns, the first column populated with the holidays from range1 (0 for missing values) and the second column with the holidays from range 2 (0 for missing values, in the example for T7 and T8).
Example if HDays_1 would be values in D2:D4 40,000 40,500, 41,000 and HDays_2 in F7:F9 42,222, 42,333 and
blank and let's say we have in H1:J1 values 1, 0, 1 (instead of the hardcoded {1\0} and {0\1})
then
MMULT(IF(ISNUMBER(HDays_1),HDays_1,0),H1:I1) will result in a 3x2 matrix with 40,000, 40,500 and 41,000 in the first column and zeroes in the second column.
The part
MMULT(IF(ISNUMBER(HDays_2),HDays_2,0),I1:J1) will result in a 3x2 matrix with zeroes in the first column and 42,222, 42,333 and 0 (replacing the blank in F9) in the second column.
So the sum of these 2 parts will return a matrix with the first range of holidays in column 1 and the second range of holidays in column 2.
HDays_1 and HDays_2 are the original holiday ranges with cells added to the smallest range so both are equally sized.