You've probably heard from your former teacher that Modern Standard Arabic (Fus-ha) is used when speaking formally, and that a dialect (Egyptian or another) is used to speak informal Arabic. How true do you think this is?
Imagine that you're in a business meeting in Egypt conducted by your superiors who are discussing business issues, and all of a sudden you are asked to participate. Which language would you use?
You can definitely choose to speak in Fus-ha if you want to sound like Shakespeare speaking English, or you can just speak FORMALLY in Egyptian.
YES! Egyptian CAN be formal. It can even feel more formal than Fus-ha, only because Fus-ha is the default classic Arabic (so you got no choice BUT to be formal really). In fact, not all formal situations tolerate Fus-ha Arabic.
Remember, حَضْرِتَك and يافَنْدِم can work wonders!