logo
search
Formula Errors

How to Fix #N/A Errors in Excel MIN and STOCKHISTORY Formulas

WPS EditorWPS Editor Sep 25, 2026 868 views

Question details

The user needs to resolve an #N/A error that occurs when combining the MIN and STOCKHISTORY functions in Excel.

Fixing #N/A Errors in Excel MIN and STOCKHISTORY Formulas
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.
Before you start

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.

Solution 1Recommended

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.

1
Select the formula cell

Click on the cell that contains your current MIN and STOCKHISTORY formula.

2
Edit the formula

Click into the formula bar at the top of the worksheet to edit your existing formula.

3
Insert the IFERROR function

Modify the formula to wrap the STOCKHISTORY part with IFERROR. For example, type: =MIN(IFERROR(STOCKHISTORY(C17,TODAY()-365,TODAY(),0),0))

4
Use an empty string (Optional)

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),""))

5
Apply the new formula

Press Enter to execute the formula. The MIN function should now return the correct minimum value instead of an #N/A error.

Wrap the STOCKHISTORY Formula with IFERROR
Formula Fixed: By catching the error, your MIN function will now successfully ignore the missing data points and compute the minimum value.
Free Microsoft Office alternative

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. 1. Download WPS Office: Visit the official WPS website and download the free WPS Office suite.
  2. 2. Install and Launch: Run the installer and open WPS Spreadsheets.
  3. 3. Open Your Workbooks: Open your existing .xlsx spreadsheets directly in WPS Office to enjoy seamless and fast data management.
Fully compatible with Microsoft Excel formats (.xlsx and .xls)Free and lightweight alternative with a familiar user interfaceExcellent support for standard financial functions and data array analysisRequires no steep learning curve for quick migration
microsoft office alternative - wps office

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.