How to automatically apply this formula?