Building Thirty-four Ticker Historical Price Datasets with Excel’s STOCKHISTORY and Sheets’ GOOGLEFINANCE Functions

A prior post in this blog reported model results that showed three of four leveraged single-stock ETFs outperformed their underlying security counterparts.  A reader of the prior post asked a very important question: does the outperformance apply to more than just three of four ticker pairs?

The reader wanted the model results replicated for a larger set of tickers than just four pairs.  Providing more results for more tickers depends on the easy availability of historical ticker prices for financial instruments, such as single-stock ETFs and their underlying tickers.

To provide more empirical evidence about any trading strategy, self-directed traders and non-institutional analysts require easy ways to compile historical prices for custom sets of financial instruments.  This post offers self-directed traders and non-institutional analysts step-by-step demonstrations for how to download large historical stock price datasets with either the Microsoft Excel STOCKHISTORY function or the Google Sheets GOOGLEFINANCE function – two widely available means of collecting historical stock price series without any special surcharge.

Tickers Tracked in this Post

This section briefly introduces thirty-four tickers for the collection of historical prices.  The thirty-four tickers are divided into two sets – one for leveraged single-stock ETFs and another for matching underlying tickers.
The following lists seventeen leveraged single-stock ETFs tracked in this post.  Each ETF is identified by both its ticker name and its security name.  A ticker name serves as a nickname or alias for the security name.
For a single-stock leveraged ETF, the security name reveals the ETF name, the leverage ratio, and the issuer of the ETF.  For example, the first ETF with a ticker name of AAPB is
  • Issued by a firm named GraniteShares
  • that depends on an underlying security with a ticker name of AAPL (Apple Corporation)
  • and targets a daily return which is twice up or down relative to the underlying security’s daily change percentage.
The second ETF with a ticker name of AMUU is
  • issued by a firm named Direxion
  • that depends on an underlying security with a ticker name of AMD (Advanced Micro Devices, Inc.)
  • and targets a daily return which is twice either up or down relative to the underlying security’s daily change percentage.
It is common, but not required, for leveraged single-stock ETFs to target twice the daily return of their underlying security.  When you are compiling a list of single-stock ETFs you should choose financial instruments that are representative of whatever securities you seek to analyze or model.


Tracked Single-Stock ETFs
Tickers and Security Names
TickerSecurity Name
AAPBGraniteShares 2x Long AAPL Daily ETF
AMUUDirexion Daily AMD Bull 2X Shares
AMZUDirexion Daily AMZN Bull 2X Shares
AVGGLeverage Shares 2X Long AVGO Daily ETF
BABXGraniteShares 2x Long BABA Daily ETF
CONLGraniteShares 2x Long COIN Daily ETF
CRWLGraniteShares 2x Long CRWD Daily ETF
GGLLDirexion Daily GOOGL Bull 2X Shares
LLYXDefiance Daily Target 2X Long LLY ETF
METUDirexion Daily META Bull 2X ETF
MSFUDirexion Daily MSFT Bull 2X Shares
MSTUT-REX 2X Long MSTR Daily Target ETF
MUUDirexion Daily MU Bull 2X ETF
NVDLGraniteShares 2x Long NVDA Daily ETF
PTIRGraniteShares 2x Long PLTR Daily ETF
SNXXTradr 2X Long Sndk Daily ETF
TSLLDirexion Daily TSLA Bull 2X Shares

The next table lists the seventeen underlying securities for the leveraged single-stock ETFs in the preceding table. Again, each security is identified by both its ticker name and its security name. The ticker name for each underlying security appears in a matching single-stock ETF name. The daily percentage price change of the following securities is the target that is leveraged by the leverage ratio of its matching leveraged single-stock ETF.


Tracked Underlying
Tickers and Security Names
TickerSecurity Name
AAPLApple Inc.
AMDAdvanced Micro Devices, Inc.
AMZNAmazon.com, Inc.
AVGOBroadcom Inc.
BABAAlibaba Group Holding Limited
COINCoinbase Global, Inc.
CRWDCrowdStrike Holdings, Inc.
GOOGLAlphabet Inc.
LLYEli Lilly and Company
METAMeta Platforms, Inc.
MSFTMicrosoft Corporation
MSTRStrategy Inc.
MUMicron Technology, Inc.
NVDANVIDIA Corporation
PLTRPalantir Technologies Inc.
SNDKSandisk Corporation
TSLATesla, Inc.

STOCKHISTORY Expressions and Return Values

Now that you know what tickers are tracked in this post, the next step is to show the STOCKHISTORY expressions that will download historical price values from a source website (MSN Money / MSN Finance) into an Excel worksheet in an Excel workbook.

The following table contains seventeen Ticker/Historical Price History Expression pairs for leveraged single-stock ETFs.  Each STOCKHISTORY expression has eight comma-separated parameters.
  • The first parameter is the ticker symbol.  This parameter is what makes each expression unique in the table.
  • The STOCKHISTORY function expression in my experience uses the second parameter to return the earliest possible date for the ticker in the first parameter  from the source website  (MSN Money / MSN Finance).
  • The third parameter designates the last date for which data is downloaded from the source website.  This parameter value must be on or before the last date for which price data is available at the source website.  As an analyst, you can set this parameter according to your data collection requirements.
  • The fourth parameter specifies the interval code for the returned data.  A value of 0 requests daily historical prices.  Other interval codes (such as weekly or monthly) exist.  Daily values are used for this post because they provide the highest resolution time series for comparing leveraged single stock ETFs.
  • The fifth parameter designates whether the returned data should include headers.  A value of 1 indicates that the first row of the returned array contains column labels.  This makes the output easier to interpret and aligns with the formatting used in the tables later in the post.
  • The sixth parameter specifies the first data property to return.  A value of 0 requests the Date column.  In this post, Date is intentionally included first so that all tickers share a common time axis, but this is optional – STOCKHISTORY allows properties in any order.
  • The seventh parameter specifies an additional data property to include.  A value of 2 requests the Open column.  Because the properties are listed as 0, 2, 1, the returned columns appear in the order Date → Open → Close.
  • The eighth parameter specifies another additional data property to include.  A value of 1 designates the Close column. Together, the three properties 0, 2, 1 produce the three column output shown in the screenshot: Date, Open, Close.
STOCKHISTORY Expressions for Single-Stock ETFs
TickerHistorical Price History Expressions
AAPB=STOCKHISTORY("AAPB",DATE(1901,1,1),DATE(2026,4,30),0,1,0,2,1)
AMUU=STOCKHISTORY("AMUU",DATE(1901,1,1),DATE(2026,4,30),0,1,0,2,1)
AMZU=STOCKHISTORY("AMZU",DATE(1901,1,1),DATE(2026,4,30),0,1,0,2,1)
AVGG=STOCKHISTORY("AVGG",DATE(1901,1,1),DATE(2026,4,30),0,1,0,2,1)
BABX=STOCKHISTORY("BABX",DATE(1901,1,1),DATE(2026,4,30),0,1,0,2,1)
CONL=STOCKHISTORY("CONL",DATE(1901,1,1),DATE(2026,4,30),0,1,0,2,1)
CRWL=STOCKHISTORY("CRWL",DATE(1901,1,1),DATE(2026,4,30),0,1,0,2,1)
GGLL=STOCKHISTORY("GGLL",DATE(1901,1,1),DATE(2026,4,30),0,1,0,2,1)
LLYX=STOCKHISTORY("LLYX",DATE(1901,1,1),DATE(2026,4,30),0,1,0,2,1)
METU=STOCKHISTORY("METU",DATE(1901,1,1),DATE(2026,4,30),0,1,0,2,1)
MSFU=STOCKHISTORY("MSFU",DATE(1901,1,1),DATE(2026,4,30),0,1,0,2,1)
MSTU=STOCKHISTORY("MSTU",DATE(1901,1,1),DATE(2026,4,30),0,1,0,2,1)
MUU=STOCKHISTORY("MUU",DATE(1901,1,1),DATE(2026,4,30),0,1,0,2,1)
NVDL=STOCKHISTORY("NVDL",DATE(1901,1,1),DATE(2026,4,30),0,1,0,2,1)
PTIR=STOCKHISTORY("PTIR",DATE(1901,1,1),DATE(2026,4,30),0,1,0,2,1)
SNXX=STOCKHISTORY("SNXX",DATE(1901,1,1),DATE(2026,4,30),0,1,0,2,1)
TSLL=STOCKHISTORY("TSLL",DATE(1901,1,1),DATE(2026,4,30),0,1,0,2,1)

For full details on the STOCKHISTORY function — including the property codes (0–5) that control which columns appear in the returned dataset — see Microsoft’s official documentation.

The STOCKHISTORY syntax for downloading historical prices for underlying securities is identical to the syntax for downloading historical prices for single-stock ETFs.  While the syntax is identical, you must, of course, change the first parameter for the STOCKHISTORY function to point at the ticker value for an underlying security (for example, replace AAPB with AAPL).

The following table shows the appropriate STOCKHISTORY function for each of the 17 underlying security tickers tracked in this post.  As with the preceding table in this section there are two columns in the table — the first one for the ticker and the second for the ticker’s STOCKHISTORY expression.  Table rows are ordered by ticker value.

STOCKHISTORY Expressions for Underlying Securities
TickerHistorical Price History Expressions
AAPL=STOCKHISTORY("AAPL",DATE(1901,1,1),DATE(2026,4,30),0,1,0,2,1)
AMD=STOCKHISTORY("AMD",DATE(1901,1,1),DATE(2026,4,30),0,1,0,2,1)
AMZN=STOCKHISTORY("AMZN",DATE(1901,1,1),DATE(2026,4,30),0,1,0,2,1)
AVGO=STOCKHISTORY("AVGO",DATE(1901,1,1),DATE(2026,4,30),0,1,0,2,1)
BABA=STOCKHISTORY("BABA",DATE(1901,1,1),DATE(2026,4,30),0,1,0,2,1)
COIN=STOCKHISTORY("COIN",DATE(1901,1,1),DATE(2026,4,30),0,1,0,2,1)
CRWD=STOCKHISTORY("CRWD",DATE(1901,1,1),DATE(2026,4,30),0,1,0,2,1)
GOOGL=STOCKHISTORY("GOOGL",DATE(1901,1,1),DATE(2026,4,30),0,1,0,2,1)
LLY=STOCKHISTORY("LLY",DATE(1901,1,1),DATE(2026,4,30),0,1,0,2,1)
META=STOCKHISTORY("META",DATE(1901,1,1),DATE(2026,4,30),0,1,0,2,1)
MSFT=STOCKHISTORY("MSFT",DATE(1901,1,1),DATE(2026,4,30),0,1,0,2,1)
MSTR=STOCKHISTORY("MSTR",DATE(1901,1,1),DATE(2026,4,30),0,1,0,2,1)
MU=STOCKHISTORY("MU",DATE(1901,1,1),DATE(2026,4,30),0,1,0,2,1)
NVDA=STOCKHISTORY("NVDA",DATE(1901,1,1),DATE(2026,4,30),0,1,0,2,1)
PLTR=STOCKHISTORY("PLTR",DATE(1901,1,1),DATE(2026,4,30),0,1,0,2,1)
SNDK=STOCKHISTORY("SNDK",DATE(1901,1,1),DATE(2026,4,30),0,1,0,2,1)
TSLA=STOCKHISTORY("TSLA",DATE(1901,1,1),DATE(2026,4,30),0,1,0,2,1)

This post section closes with several examples of STOCKHISTORY functions embedded in an Excel workbook.  Each function should reside on a separate worksheet within the workbook.

The following screenshots display the STOCKHISTORY functions for the AAPB and AMUU tickers in the xlsource_04_30_2026.xlsx workbook. Each formula shown in the screenshots is copied directly from the earlier examples in this section and pasted into cell A1 of the worksheet named after the corresponding ticker.

Notice that the returned datasets for AAPB and AMUU begin on different dates. These differing start dates reflect the first trading day available for each ticker on the source website. By specifying a second parameter value of DATE(1901,1,1), the STOCKHISTORY function automatically detects the earliest available date for each ticker and returns data beginning on that date.






The final screenshot in this section shows the TSLA worksheet, which is the thirty fourth tab in the xlsource_04_30_2026.xlsx workbook.  The STOCKHISTORY expression used on this tab is copied from the last row of the STOCKHISTORY Expressions for the Underlying Securities table.  As with the other worksheets, the formula is placed in cell A1, and the returned array populates the Date, Open, and Close columns for the TSLA ticker.



GOOGLEFINANCE Expressions and Return Values

The Sheets’ GOOGLEFINANCE function allows a similarly formatted return set as the Excel’s STOCKHISTORY function reviewed in the preceding section.  However, the syntax for generating return sets is slightly different with the GOOGLEFINANCE function than with the STOCKHISTORY function.

It is important to be able to generate similarly formatted return sets through different data providers.  No single data provider, such as Google, Microsoft, or some other data provider can guarantee one hundred percent coverage of all financial instruments all the time.  Knowing how to populate return sets with any of several different vendors allows you to track down gaps, return sets with incorrect values, and temporary outages, which can have unknown durations from minutes to weeks or longer.

A good general introduction to the GOOGLEFINANCE function is available at this Google Docs Editors Help page.  Some readers may also derive value from this introductory post on this blog to the GOOGLEFINANCE function.

The following two tables show the GOOGLEFINANCE syntax for returning historical price values for the thirty-four tickers tracked in this post.  The GOOGLEFINANCE expressions in the first table are for single-stock ETFs, and the second table is for underlying securities for the tickers tracked by the first table.  There is one exception (BABA), which receives more coverage in the Data Issues section.

The expressions in the two tables below embed GOOGLEFINANCE expressions in query function wrappers.  This design feature is to return just values for Date, Open, and Close values from the underlying source website (Google Finance).

  • The nested GOOGLEFINANCE expression with the “all” parameter returns six columns of data (namely, Date and OHLCV values).
  • Three-column value sets are returned from the outer query function with names of Date, Open, and Close.
  • Some ticker names in the first table have NASDAQ as an exchange prefix.  For many tickers, the Google Finance function can automatically return the correct historical values without an exchange prefix, but a prefix is required for tickers AAPB through GGLL in the following table.
  • Notice that the earliest possible start date is specified as date(1902,1,1). This is one year after the earliest possible start date for the STOCKHISTORY function. On the other hand, it serves a similar purpose — namely, in my experience, returning the first date for which Google Finance has real trading data for the ticker, without you having to look it up in advance so you can precisely specify the first trading date for each ticker in your project.


GOOGLEFINANCE Expressions for Single-Stock ETFs
TickerHistorical Price History Expressions
AAPB=query(googlefinance("NASDAQ:AAPB", "all", date(1902,1,1), date(2026,4,30)), "select Col1, Col2, Col5 label Col5 'Close'")
AMUU=query(googlefinance("NASDAQ:AMUU", "all", date(1902,1,1), date(2026,4,30)), "select Col1, Col2, Col5 label Col5 'Close'")
AMZU=query(googlefinance("NASDAQ:AMZU", "all", date(1902,1,1), date(2026,4,30)), "select Col1, Col2, Col5 label Col5 'Close'")
AVGG=query(googlefinance("NASDAQ:AVGG", "all", date(1902,1,1), date(2026,4,30)), "select Col1, Col2, Col5 label Col5 'Close'")
BABX=query(googlefinance("NASDAQ:BABX", "all", date(1902,1,1), date(2026,4,30)), "select Col1, Col2, Col5 label Col5 'Close'")
CONL=query(googlefinance("NASDAQ:CONL", "all", date(1902,1,1), date(2026,4,30)), "select Col1, Col2, Col5 label Col5 'Close'")
CRWL=query(googlefinance("NASDAQ:CRWL", "all", date(1902,1,1), date(2026,4,30)), "select Col1, Col2, Col5 label Col5 'Close'")
GGLL=query(googlefinance("NASDAQ:GGLL", "all", date(1902,1,1), date(2026,4,30)), "select Col1, Col2, Col5 label Col5 'Close'")
LLYX=query(googlefinance("LLYX", "all", date(1902,1,1), date(2026,4,30)), "select Col1, Col2, Col5 label Col5 'Close'")
METU=query(googlefinance("METU", "all", date(1902,1,1), date(2026,4,30)), "select Col1, Col2, Col5 label Col5 'Close'")
MSFU=query(googlefinance("MSFU", "all", date(1902,1,1), date(2026,4,30)), "select Col1, Col2, Col5 label Col5 'Close'")
MSTU=query(googlefinance("MSTU", "all", date(1902,1,1), date(2026,4,30)), "select Col1, Col2, Col5 label Col5 'Close'")
MUU=query(googlefinance("MUU", "all", date(1902,1,1), date(2026,4,30)), "select Col1, Col2, Col5 label Col5 'Close'")
NVDL=query(googlefinance("NVDL", "all", date(1902,1,1), date(2026,4,30)), "select Col1, Col2, Col5 label Col5 'Close'")
PTIR=query(googlefinance("PTIR", "all", date(1902,1,1), date(2026,4,30)), "select Col1, Col2, Col5 label Col5 'Close'")
SNXX=query(googlefinance("SNXX", "all", date(1902,1,1), date(2026,4,30)), "select Col1, Col2, Col5 label Col5 'Close'")
TSLL=query(googlefinance("TSLL", "all", date(1902,1,1), date(2026,4,30)), "select Col1, Col2, Col5 label Col5 'Close'")



GOOGLEFINANCE Expressions for Underlying Securities
TickerHistorical Price History Expressions
AAPL=query(googlefinance("AAPL", "all", date(1902,1,1), date(2026,4,30)), "select Col1, Col2, Col5 label Col5 'Close'")
AMD=query(googlefinance("AMD", "all", date(1902,1,1), date(2026,4,30)), "select Col1, Col2, Col5 label Col5 'Close'")
AMZN=query(googlefinance("AMZN", "all", date(1902,1,1), date(2026,4,30)), "select Col1, Col2, Col5 label Col5 'Close'")
AVGO=query(googlefinance("AVGO", "all", date(1902,1,1), date(2026,4,30)), "select Col1, Col2, Col5 label Col5 'Close'")
BABA* See this post's Data Issues section.
COIN=query(googlefinance("COIN", "all", date(1902,1,1), date(2026,4,30)), "select Col1, Col2, Col5 label Col5 'Close'")
CRWD=query(googlefinance("CRWD", "all", date(1902,1,1), date(2026,4,30)), "select Col1, Col2, Col5 label Col5 'Close'")
GOOGL=query(googlefinance("GOOGL", "all", date(1902,1,1), date(2026,4,30)), "select Col1, Col2, Col5 label Col5 'Close'")
LLY=query(googlefinance("LLY", "all", date(1902,1,1), date(2026,4,30)), "select Col1, Col2, Col5 label Col5 'Close'")
META=query(googlefinance("META", "all", date(1902,1,1), date(2026,4,30)), "select Col1, Col2, Col5 label Col5 'Close'")
MSFT=query(googlefinance("MSFT", "all", date(1902,1,1), date(2026,4,30)), "select Col1, Col2, Col5 label Col5 'Close'")
MSTR=query(googlefinance("MSTR", "all", date(1902,1,1), date(2026,4,30)), "select Col1, Col2, Col5 label Col5 'Close'")
MU=query(googlefinance("MU", "all", date(1902,1,1), date(2026,4,30)), "select Col1, Col2, Col5 label Col5 'Close'")
NVDA=query(googlefinance("NVDA", "all", date(1902,1,1), date(2026,4,30)), "select Col1, Col2, Col5 label Col5 'Close'")
PLTR=query(googlefinance("PLTR", "all", date(1902,1,1), date(2026,4,30)), "select Col1, Col2, Col5 label Col5 'Close'")
SNDK=query(googlefinance("SNDK", "all", date(1902,1,1), date(2026,4,30)), "select Col1, Col2, Col5 label Col5 'Close'")
TSLA=query(googlefinance("TSLA", "all", date(1902,1,1), date(2026,4,30)), "select Col1, Col2, Col5 label Col5 'Close'")


As with the STOCKHISTORY function, it is often a best practice to include one GOOGLEFINANCE function per worksheet in a Sheets workbook for a project.  It is also recommended that you name the tab for each worksheet after the ticker for the GOOGLEFINANCE expression that populates the worksheet with historical prices.  This practice enforces a rule of one ticker per worksheet.

Except for occasional data glitches associated with underlying source web sites and other related issues, such as the need to reformat content, GOOGLEFINANCE and STOCKHISTORY functions return the same historical prices for each ticker.  The following three screenshots from this section compared to the analogous screen shots from the preceding section confirm the pattern of identical return values across functions for the same tickers.

The following three screenshots show excerpted contents for the AAPB, AMUU, and TSLA tickers from a GOOGLEFINANCE function in a Sheets workbook just like the final screenshots in the preceding section show the same content for the same tickers for the STOCKHISTORY function in an Excel workbook.

  • Notice that the formula bar in each of the following screenshots is filled with a GOOGLEFINANCE function.  The function for each screen shot has a distinct ticker in its formula.
  • The first nine rows of each  screenshot has the column headers followed by the first eight rows of returned date, open, and close values.
  • The actual return values for each ticker below has identical column values to the corresponding three screenshots at the end of the preceding section.
It would be possible to compute correlation coefficients between matching columns from STOCKHISTORY versus GOOGLEFINANCE, but I believe this simple visual comparison is just as compelling in the way that it reveals the GOOGLEFINANCE return values can perfectly match the corresponding STOCKHISTORY return values.






Data Issues

In compiling the data for this post, I encountered two data issues – one for the GOOGLEFINANCE function and another for the STOCKHISTORY function.  Both issues were related to the source website for each function type, but the details for each issue were unique.

GOOGLEFINANCE Issue: Missing Data for BABA

The GOOGLEFINANCE function was unable to return values for the BABA ticker.  When attempting to extract the historical data, the function simply threw an #N/A error stating that the query returned no data.  To resolve this, I with the assistance of Google Gemini, attempted approximately a dozen different syntax configurations.  Every single variation failed.  Because the exact same approach worked perfectly for the other tickers, and because so many different syntax formulas were tested, it became clear that the problem was a web server issue on Google's end rather than a syntax error on our side.




STOCKHISTORY Issue: Incorrect Data Returned for AVL

The second issue involved the STOCKHISTORY function’s failure to return a valid dataset for the AVL ticker — widely referenced online as the single‑stock ETF for Broadcom (AVGO).

The following screenshot shows an excerpt of the GOOGLEFINANCE ticker’s return set for the AVL ticker.



The next screenshot shows the STOCKHISTORY ticker’s return set for the AVL ticker.  Notice that AVL’s  first trading date from the STOCKHISTORY function is nearly 17 years  earlier than the GOOGLEFINANCE result.  When I crosschecked these early dates and prices with Yahoo Finance, Yahoo matched GOOGLEFINANCE — not STOCKHISTORY.




Important notice: STOCKHISTORY obtains its historical price data from MSN Money / MSN Finance rather than from LSEG Data & Analytics as reported in some earlier blog posts, such as “How to Populate a Trading Database with Refinitiv, Excel, and SQL Server”, “How to Populate a Trading Database with Refinitiv, Excel, and SQL Server—Update 2”, and “A Model to Lock-in Gains When Trading Single-stock ETFs”. This distinction matters because MSN Money maintains its own ticker history and mapping rules. As a result, STOCKHISTORY may return outdated or legacy data for tickers that have been recycled or previously assigned to unrelated companies.  This issue did not surface in prior applications of the STOCKHISTORY  function in this blog

These were the only two data issues that I encountered when compiling data for this post.  The reason for showing them to you is so that you can understand how GOOGLEFINANCE and STOCKHISTORY can complement each other when you are collecting historical price data for a large set of tickers.

Concluding Comments

You are invited to visit the Security Trading Analytics blog to discover follow-up posts to the current post as well as fresh posts for demonstrating security trading analytics techniques.  Also, you can discover two techniques for navigating prior posts at “A Blog for Traders Who Like to Analyze Their Trades and Data Analysts Who Like to Trade” that may be useful for your security trading or security analysis projects.


Comments

Popular posts from this blog