Can I use the profits from selling investment property into buying a personal home without paying capital gain tax?

Hello all,

 

I had originally purchased a home to live in. But suddenly due to work, I needed to move away. As such, due to the fact that I was leaving so quickly I didn't want to sell the house right away because I would have lost a lot.

 

It's now been a few years and I now plan on selling that home and using the profit from that home to buy a personal home where I would live full time in. I know that if I had sold a personal home I could use the profits from that home sell towards buying a new personal home without paying taxes. But didn't know if I could do the same thing for my situation. 

 

Does anyone know?