A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
Hi, Kin Wai1
Welcome to the Microsoft Community.
To calculate the year-to-date (YTD) change of a stock price in Excel by comparing the latest price each day against the closing price on January 2, 2025, you can use the STOCKHISTORY function along with some basic formulas.
Ref***: 《*** STOCKHISTORY function - Microsoft Support 》
**Important:**The STOCKHISTORY function requires a Microsoft 365 Personal, Microsoft 365 Family, Microsoft 365 Business Standard, or Microsoft 365 Business Premium subscription.
- Get the closing price on January 2, 2025:
- Assume the stock ticker symbol is in cell
A1(e.g., "AAPL" for Apple). - Use the
STOCKHISTORYfunction to get the closing price on January 2, 2025: =STOCKHISTORY(A1, "2025-01-02", "2025-01-02", 0, 1, 0, 5)
B1). - Assume the stock ticker symbol is in cell
- Get the latest stock price:
- Use the
STOCKHISTORYfunction to get the latest closing price: =STOCKHISTORY(A1, TODAY(), TODAY(), 0, 1, 0, 5)
B2). - Use the
- Calculate the YTD change:
- Use the following formula to calculate the YTD change:
excel =(B2 - B1) / B1This formula calculates the percentage change by subtracting the closing price on January 2, 2025, from the latest price, dividing the result by the closing price on January 2, 2025, and then multiplying by 100 to get the percentage.
- Use the following formula to calculate the YTD change:
Here's a step-by-step example:
- Enter the stock ticker symbol in cell
A1(e.g., "AAPL"). - Enter the formula to get the closing price on January 2, 2025 in cell
B1:=STOCKHISTORY(A1, "2025-01-02", "2025-01-02", 0, 1, 0, 5) - Enter the formula to get the latest closing price in cell
B2:=STOCKHISTORY(A1, TODAY(), TODAY(), 0, 1, 0, 5) - Enter the formula to calculate the YTD change in cell
C1:=(B2 - B1) / B1
This will give you the year-to-date change of the stock price as a percentage.
If you have any more questions or need further assistance, feel free to ask!
Don't worry if the problem is not resolved, share your results and we will provide you with more support.
Best regards,
Cherry.Z - MSFT | Microsoft Community Support Specialist