OK, there are several ways to do this I think, you could possibly use the numbers in column G but I reckon this is a little shorter.
For either the last working day in the month or the second last if you add 2 working days you will get a date in the following month (that wouldn't be true for earlier dates) so if you test the month of A2 against the month of WORKDAY(A2,2,holidays) then when they don't match you know that you have one of the last 2 workdays, i.e.
=IF(MONTH(A2)<>MONTH(WORKDAY(A2,2,M$2:M$100)),1,"")
....but if you have all dates listed then that will also put a 1 against any weekend or holiday date that comes after the second last workday......so you also have to test that A2 itself is a workday. You can do that by using NETWORKDAYS(A2,A2), if A2 is a workday that returns 1 if not it returns zero.
In fact you need to modify the formula I suggested, the holiday range should also go in the NETWORKDAYS function like this
=IF((MONTH(A2)<>MONTH(WORKDAY(A2,2,M$2:M$100)))*NETWORKDAYS(A2,A2,M$2:M$100),1,"")
Bookmarks