Function Problems

How to Use a Named Cell in the Excel STOCKHISTORY Function

Rana GarciaRana Garcia Nov 11, 2026 870 views

Question details

The user wants to replace a hard-coded DATE function within an Excel STOCKHISTORY formula with a named cell to allow for dynamic and easy end-date updates.

How to Use a Named Cell in the Excel STOCKHISTORY Function
Product
Excel
Device & OS
not provided
Scenario
Building a dynamic financial tracker or stock model where the historical date range needs to be updated frequently without editing the formula manually.
Observed behavior
The formula requires the end date to reference a defined named range instead of a static DATE function.
Before you start

Ensure that the cell you intend to use as your named range is formatted as a valid Excel date (e.g., MM/DD/YYYY) so the STOCKHISTORY function can process it properly.

Solution 1Recommended

Replace the Hard-Coded Date with a Named Range

Modify your STOCKHISTORY formula to point directly to a defined named cell instead of using a static DATE function.

By replacing the static DATE function with a named range, you can quickly change the start or end date of your stock data directly from a worksheet cell, making your financial models much more flexible.

1
Create the named range

Select the cell that contains your desired end date. Click into the Name Box located to the left of the formula bar, type 'End_Date' (or your preferred name), and press Enter.

2
Update the STOCKHISTORY formula

Navigate to the cell containing your stock data formula. Replace the hard-coded date argument with your new named range. For example: =STOCKHISTORY("SCHF", DATE(2022,1,1), End_Date, 0, 0, 1)

3
Verify the results

Press Enter to execute the formula. The STOCKHISTORY function will now dynamically pull data up to the date specified in your 'End_Date' cell.

Replace the Hard-Coded Date with a Named Range
Dynamic Updates: Whenever you type a new date into the 'End_Date' cell, the STOCKHISTORY array will automatically resize and update without any need to modify the formula.
Free Microsoft Office alternative

Looking for a Lightweight Excel Alternative?

While STOCKHISTORY is a proprietary Microsoft 365 connected feature, WPS Spreadsheet is a powerful, free alternative that excels at advanced financial modeling, dynamic named ranges, and standard data analysis.

  1. 1. Download and Install: Get WPS Office for free and install it across your Windows, Mac, or Linux devices in minutes.
  2. 2. Open Existing Spreadsheets: Open your standard .xlsx files directly in WPS Spreadsheet without losing your formatting or standard formulas.
  3. 3. Manage Data Easily: Use the built-in Name Manager to assign dynamic cell references and build robust tracking sheets.
Free, lightweight, and lightning-fast performanceSeamless compatibility with Microsoft Excel (.xlsx) formatsFull support for creating and managing named rangesFamiliar tabbed interface makes migration effortless
QA img-9

Frequently Asked Questions

Why does my STOCKHISTORY formula return a #VALUE! error when using a named cell?

This error typically occurs if the named cell contains text instead of a valid Excel serial date, or if the named range is misspelled within your formula.

Can I use a named cell for the start date in the STOCKHISTORY function?

Yes, you can replace both the start date and end date arguments with named ranges. This makes your entire historical date range fully dynamic.

How do I edit or delete a named range in Excel?

Navigate to the Formulas tab on the ribbon and click 'Name Manager'. From the dialog box, you can select your named range to modify its reference or delete it entirely.

Will STOCKHISTORY automatically update to today's date?

STOCKHISTORY pulls historical data based on the dates provided. If you want it to always pull up to the current day, you can enter the formula =TODAY() inside your named cell.