MarketXLS Database Query

A flexible function that queries the MarketXLS database to perform custom calculations on fundamental data over specified time periods.

Parameters

Parameter Required Description
Database Yes Database to query ('fundamental', 'price')
Symbol Yes Stock ticker symbol
ApplyOn Yes Metric code to calculate on
DoWhat Yes Operation to perform
Periods Yes Time period for calculation

Common Metric Codes (ApplyOn)

Code Description
TOTORDSH Total Ordinary Shares
REVENUE Revenue
NETINC Net Income
EBITDA EBITDA

Operations (DoWhat)

Operation Description
growth Calculate growth rate
avg Calculate average
sum Calculate sum

Time Periods

Period Description
1y One year
3y Three years
5y Five years
10y Ten years

Examples

=mxls_db_query("fundamental", "AAPL", "TOTORDSH", "growth", "3y")
3-year shares outstanding growth
=mxls_db_query("fundamental", "MSFT", "REVENUE", "growth", "5y")
5-year revenue growth
=mxls_db_query("fundamental", "GOOGL", "NETINC", "avg", "3y")
3-year average net income
=mxls_db_query("fundamental", A1, B1, C1, D1)
Using cell references

When to Use

  • Custom growth rate calculations
  • Multi-year average calculations
  • Shares outstanding change analysis
  • Custom fundamental analysis
  • Building advanced financial models

When NOT to Use

Scenario Use Instead
Need current stock price Last()
Need simple revenue hf_Revenue()
Need predefined growth metrics Specific growth functions
Need historical time series Historical fundamental functions

Common Issues & FAQ

Q: Why am I getting "NA"? A: Check that:

  • The database name is correct ('fundamental' or 'price')
  • The metric code (ApplyOn) is valid
  • The operation (DoWhat) is supported
  • The symbol has data for the specified period

Q: What metric codes are available? A: Common codes include TOTORDSH, REVENUE, NETINC, EBITDA, GP, etc. Contact support for a full list.

Q: How is growth calculated? A: Growth is calculated as the percentage change from the start to end of the period.

Get Access to 1 Billion Usable Market data points IN YOUR EXCEL SHEETS WITH EASY TO USE EXCEL FUNCTIONS

Get started today
MarketXLS Excel Add-in Tutorial - How to Use MarketXLS Database Query and Other Financial Formulas
How does MarketXLS work?