Yes, this grammar point can be used in many situations as well. You’ll just have to adjust your endings and so on to reflect the desired level of formality.