With the dust settled on a wild earnings week, Microsoft has passed Amazon to become the second most valuable U.S. company by market cap.

At the end of the day Friday, Microsoft’s market cap stood at $821 billion versus $803 billion for Amazon. Both still trail Apple, which retains a value above $1 trillion.

Amazon stock dropped nearly 8 percent Friday but gained back 2 percent in after-hours trading. The company fell short on revenue expectations in the third quarter and issued a lower guidance for the fourth quarter than analysts anticipated. Amazon also posted record profits for the quarter thanks to businesses like Amazon Web Services and advertising.

Amazon briefly crossed the $1 trillion market cap threshold in early September, but its stock has since dropped 19 percent and its market value is down nearly $200 billion. Amazon’s slide is partially due to an overall slump in the stock market, with the Nasdaq dropping close to 11 percent during that same period.

Microsoft cruised past analyst expectations for its quarterly financials this week, powered by a variety of areas such as gaming, cloud and its Surface hardware division. However, Microsoft’s stock still dropped slightly Friday and for the week as a whole, fitting with the broader sell-off.