Fix Excel STOCKHISTORY #VALUE! Errors for S&P 500 Prices
Question details
Retrieve historical opening and closing prices for the S&P 500 index without a STOCKHISTORY #VALUE! error.

- Product
- Microsoft Excel STOCKHISTORY
- Device & OS
- not provided
- Scenario
- A user requests historical open and close prices for the S&P 500 with Excel's STOCKHISTORY function.
- Observed behavior
- The formula returns #VALUE! for the S&P 500, although another index may return results.
Check that your Excel version supports STOCKHISTORY and that you have an internet connection. Choose a past date range when the market was open, and identify the exact S&P 500 instrument you want to retrieve.
Check the S&P 500 match and test fewer STOCKHISTORY fields
Use this method to distinguish an incorrect instrument match from unavailable historical price fields.
Enter S&P 500 in cell A2, select the cell, and choose Data > Stocks. If the Data Selector appears, select the result that best matches the S&P 500 index.
In an empty cell, enter =STOCKHISTORY(A2,DATE(2024,1,1),DATE(2024,1,31),0,1,0,1) to request daily dates and closing prices.
If the test works, change the formula to =STOCKHISTORY(A2,DATE(2024,1,1),DATE(2024,1,31),0,1,0,1,2) to also request opening prices. If it fails, the linked data service may not provide that field for the selected instrument.

Import S&P 500 historical prices with Power Query
Use a financial-data provider when Excel's linked data service does not supply the required index fields.
Test a different market instrument in STOCKHISTORY
Use another supported index or fund when a market comparison is acceptable and exact S&P 500 index prices are not required.
Work with imported market data in WPS Spreadsheets
WPS Office is a free, lightweight alternative with a familiar spreadsheet interface. Open compatible Excel files and work with imported market data while moving between office suites. It does not fix Microsoft's STOCKHISTORY data service, and formula support may differ.

Frequently Asked Questions
Why does STOCKHISTORY return #VALUE! for the S&P 500?
The selected symbol may not match the intended index, or Excel's linked data service may not provide the requested historical fields. Select the instrument through Data > Stocks, then test a formula requesting only dates and closing prices.
How do I request opening prices in STOCKHISTORY?
Add property 2 to the formula's property arguments. For example, =STOCKHISTORY(A2,DATE(2024,1,1),DATE(2024,1,31),0,1,0,1,2) requests date, close, and open for the instrument in A2, if those fields are available.
Can I use the Nasdaq Composite instead of the S&P 500?
You can test it through Data > Stocks and STOCKHISTORY if a different market index meets your needs. It tracks different securities, so its prices are not S&P 500 prices.
How can I get S&P 500 prices if STOCKHISTORY does not provide them?
Find a reliable provider with the required historical fields, then use Data > Get Data > From Web or From File in Excel to import the data with Power Query.




