It has a lot to do with a chosen perspective. The really cool part is, the choice is yours.
Example: I spent a lot of years of my life addicted to drugs and alcohol. Those are years I can't get back or live over again: they are gone.
I could lament about this for the rest of my life, or..
...do what I decided to do: make that time count in a way that's positive and constructive by getting my act together and becoming a counselor so that I might help others who struggle with similar issues.
My work is spiritual. It's fulfilling. I'm not sure I'd feel the same way about it if I hadn't been through what I've been through prior to getting to be where I am today.
There is always a way to make pain be not in vain. You just have to look hard sometimes to find it.