Excel Error Codes

Fix Excel STOCKHISTORY #VALUE! Errors for S&P 500 Prices

Huma Ashraf ChHuma Ashraf Ch Nov 18, 2026 868 views

Question details

Retrieve historical opening and closing prices for the S&P 500 index without a STOCKHISTORY #VALUE! error.

Fix Excel STOCKHISTORY #VALUE! Errors for S&P 500 Prices
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.
Before you start

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.

Solution 1Recommended

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.

1
Select the index

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.

2
Test closing prices

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.

3
Add opening 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.

Check the S&P 500 match and test fewer STOCKHISTORY fields
Availability varies: A valid index match does not guarantee that Excel's linked data service provides every historical field for it. Check the instrument and date range before concluding that a field is unavailable.
Free Microsoft Office alternative

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.

Review and analyze imported historical price tablesOpen and edit Microsoft Excel XLSX and XLS filesUse a familiar spreadsheet interface for an easier transitionWork with a free, lightweight office suite
microsoft office alternative - wps office

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.