How to Fix #N/A Errors in Excel MIN and STOCKHISTORY Formulas
Question details
The user needs to resolve an #N/A error that occurs when combining the MIN and STOCKHISTORY functions in Excel.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- Attempting to calculate the minimum value of historical stock data pulled by the STOCKHISTORY function.
- Observed behavior
- The STOCKHISTORY function returns an #N/A error due to missing market data or service provider unavailability, which subsequently causes the MIN function to output an error.
Ensure you have an active and stable internet connection, as the STOCKHISTORY function requires online access to fetch financial market data from Microsoft's data providers.
Wrap the STOCKHISTORY Formula with IFERROR
Use the IFERROR function to replace #N/A errors from STOCKHISTORY with a zero or empty string, allowing the MIN function to calculate correctly without breaking.
When market data is missing for specific dates (like holidays or weekends), STOCKHISTORY returns an #N/A error. Any subsequent formula referencing this array, such as MIN, will inherit the error. Wrapping the formula in IFERROR intercepts the error before it breaks your calculation.
Click on the cell that contains your current MIN and STOCKHISTORY formula.
Click into the formula bar at the top of the worksheet to edit your existing formula.
Modify the formula to wrap the STOCKHISTORY part with IFERROR. For example, type: =MIN(IFERROR(STOCKHISTORY(C17,TODAY()-365,TODAY(),0),0))
If you prefer the cell to be ignored rather than treated as zero, replace the trailing 0 with two double quotes. Example: =MIN(IFERROR(STOCKHISTORY(C17,TODAY()-365,TODAY(),0),""))
Press Enter to execute the formula. The MIN function should now return the correct minimum value instead of an #N/A error.

Refresh Data and Reopen Workbook
Resolve underlying data service connection issues by allowing the financial data provider time to refresh.
Try WPS Office for Free and Seamless Spreadsheet Management
While Microsoft Excel handles specialized online connected data types like STOCKHISTORY, WPS Office provides a highly compatible, lightweight, and free alternative for all your standard financial modeling, data analysis, and formula management needs.
- 1. Download WPS Office: Visit the official WPS website and download the free WPS Office suite.
- 2. Install and Launch: Run the installer and open WPS Spreadsheets.
- 3. Open Your Workbooks: Open your existing .xlsx spreadsheets directly in WPS Office to enjoy seamless and fast data management.

Frequently Asked Questions
Why does STOCKHISTORY suddenly return #N/A when it worked previously?
The financial data service provider might be temporarily down, or you may have lost internet connectivity. Saving your work, reopening the file, and waiting a few minutes usually prompts a successful data refresh.
Can I return a blank cell instead of zero when fixing STOCKHISTORY errors?
Yes, you can use an empty string by typing "" at the end of your IFERROR function instead of a 0. This is often better for averages or charts where a zero might skew the results.
Does an #N/A error in STOCKHISTORY affect other formulas?
Yes, any formula referencing a cell with an #N/A error (such as MIN, MAX, or AVERAGE) will also output an #N/A error unless it is handled properly using functions like IFERROR.




