Ever since the outbreak of the COVID-19 pandemic, the focus on investments in medical and pharmaceutical enterprises has risen prominently. Overall, it is expected that the stock market would be negatively impacted by the pandemic, while as it turned out, the development, production, and sale of COVID-19 vaccines have brought about nonnegligible increases in revenues and profits for vaccine producers such as Moderna, Pfizer, and Astra Zeneca. Therefore, in-pandemic investors for medical and pharmaceutical firms desire a comprehensive analysis that takes both the negative influence COVID-19 had on the stock market and the positive impacts the sale of COVID-19 vaccines had on the medical and pharmaceutical industry into account to help with investment decisions. This study chooses five main pharmaceutical and biomedical companies worldwide that have been producing COVID-19 vaccines, and applies Mean-Variance Model to construct optimal investment portfolios and portfolios with minimum variance for both the pre-pandemic period (from January 2019 to December 2019) and in-pandemic period (from January 2020 to April 2022) based on monthly stock prices of these five firms, and analyzes the resulting portfolios by evaluating the influence from both the COVID-19 pandemic and the sale of COVID-19 vaccines. This study shows that for most corporates chosen, the positive impact from the production and sale of COVID-19 vaccines outweighed the negative impact of the pandemic itself, and it suggests that the investors should invest in Astra Zeneca before the pandemic exploded and invest in Moderna after the outbreak of the pandemic.