There's nothing at all in that formula that >>>SHOULD<<< cause any performance issues when migrating from 2016 to O365. If you want future responses here to focus on O365, please amend your profile, which now may be out of date (it shows 2016).

Again, a sample file might help.