I am making macaroni and I need 4 tablespoons of butter, but I don't have any butter. I am going to use coconut oil as a substitute but do I use the same amount of oil as butter? Or should I use something else as a substitute?
In almost all contexts, you can substitute these items on equal amounts, by weight or volume, and be well within the tolerance of the recipe.
This is true for almost all baked goods, for example.
If you want to be absolutely accurate, butter is only about 80% fat, and 20% water (this is an approximation), so you would use 4/5 the amount of coconut oil as butter.