I do not like ricotta so can I use yogurt instead
Yes! I would use Greek yogurt, preferably full-fat, to get as close as possible. (Unstrained yogurt might be too watery, depending on the recipe.)
The yoghurt will have more acidity, which will have some effect if the cake uses a leavener such as baking soda or powder- it doesn't seem likely that it will have a large effect, or a negative one, but it's something to be aware of.
I often use yogurt in baking. Given its greater acidity than ricotta, add 1/2 teaspoon of baking soda along with your dry ingredients.