You can't do that with formula, you must custom code it. There is a video tutorial and my own self-experience on how to do that.
See: https://www.youtube.com/watch?v=MdaJIGxOWpU
My experience here:
See: https://www.youtube.com/watch?v=MdaJIGxOWpU
My experience here:
Comment