Sorry John that’s a typo, I fixed it. It’s correct in the template code.
(The loop wouldn’t give any values if it was missing)
Anyway, it seems that the echo number_format adjustment is what confuses the sorter so that it’s treated like a regular string and not a number/currency which is problematic. The commas need to be parsed in before not after. Arg.