The result of IF looks is this array:

which goes into the TEXTJOIN function as text1.

TEXTJOIN is configured to use a comma as the delimiter, and to ignore empty values.

You will also need toenable text wrapping.

Excel formula: Join cells with comma

you’re free to use boolean logic like this for AND:

Explained in more detail here.

Excel formula: List holidays between two dates

Excel TEXTJOIN function