If you only need to do this once, just do out all the permutations, it will not take long if you do it in a systematic manner.
If you need it to be dynamic, meaning the 5 entities are changing, I would do all the permutations out for numbers 1 through 5, and then do a find/replace all:
find "1", replace with "=a1"
find "2", replace with "=a2", etc
with the 5 characters you need listed in a1 through a5.
Is this what you're looking for?