how long does it take to get a refund from the marketplace

I bought something and it doesnt work

This only can be discussed with the marketplace team by e-mail, the info thou you can find here: Marketplace FAQ - Unreal Engine

It depends. What is the item and how doesn’t it work? Generally the creator is given an opportunity to fix any issue before a refund is given.