Stamp duty refund

Was wondering if someone can advise. We owned a house for 5 years then moved out and rented it for 18 months and continuing (while ourselves renting as well). Now want to buy a house (which will be second house so higher rate stamp duty). If I sell my old rented house next year can I reclaim the higher rate stamp duty which I paid?

I know it is within three years but is it three years from the time you stopped living in your earlier main home or three years from buying a new property and selling old one?

Appreciate any help.

The three years starts when you buy the new place. You have to sell the old property within that window to reclaim the higher stamp duty.

Thanks. That was my understanding but someone confused be. Is there a time limit also between stopping to live in old house and buy new one??. Or it can be anytime as long as you sell your old main home within three years of buying.
Thanks