Butter and cooking oil are not interchangeable in every recipe.
Butter actually has water in it, while oil is a pure lipid. This can cause problems with water-sensitive preparations, for example a choux paste (where the proper ratio of water to flour is extremely important) or anything using melted chocolate (where the water in butter can cause it to seize).
Butter can also be whipped; oil definitely cannot (except coconut oil). You normally wouldn't use olive or sunflower oil in, for example, an icing.
Butter is a solid at room temperature, while oil is a liquid. When making something that needs to be relatively solid - for example, bread or pie dough or anything requiring a beurre manié - you do not want to substitute butter for oil. Shortening is a better substitute.
Butter has a much lower smoke point and will scorch at temperatures that oils are often subjected to. You have to be very careful when frying anything in butter, and you'll need to watch carefully if baking with butter at very high temperatures.
You have to understand the recipe you are making if you want to know how to do the conversion (or if a conversion is even possible). If the recipe is fat-dependent, you need to use more butter than oil. If it is water-dependent, you generally should use less butter. If it is both, you likely can't do a direct substitution and will have to add or remove something else. And if the recipe relies on the solid/liquid state of the fat, then you simply cannot substitute.
Muffins just happen to be one of those things where it really doesn't matter much. Like all quickbreads, you can vary the amount of fat substantially and all it will do is change the texture of the final dish; quickbreads with more fat tend to be richer, more moist, and less dense. The Joy of Cooking recipe for waffle batter recommends anywhere from 1/4 cup to 1 cup of butter, which is a pretty wide margin of error; in recipes like that, you can usually play fast and loose with the substitutions.