Thank you very much for the formula solution. That's exactly what I needed dynamic array formula that spills. Good use of FILTERXML.
Could you explain what //y signify how does it refer to SUBSTITUTE text?
I replaced //y to //x/y as per the syntax.
Could you direct me to any source for using different XML functions like first().