Hi again mathemancers!

Okay so I need to normalize a variable.

i.e. I have variable X and variable Y, and I want Y to always tend towards X. So if Y is greater than X, reduce Y. And if Y is less than X, increase Y.

Normally I would of course do this using IF statements, but that's kinda infeasible (or unreasonably complicated) for what I'm currently working on and I'm really hoping there's a maths algorithm than can be used here.

Cheers!