I must be missing something, but why not a simple formula?

Capture.JPG