I did not know about the existence of dynamic replace! Goes to show that you can always learn something new, even if you use Alteryx all the time. Never Stop Learning!
I decided to go the macro route, drawing my inspiration from the CReW dynamic formula tool. Definitely the more complicated route... But hey, when else are you editing the XML in a tool?!
Looks like several other of the responses had the same issue I did. I could not match the output in the solution. I even resorted to copying it to Excel to see what it would produce. It is an order of operations issue as many have identified.