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")=mxls_db_query("fundamental", "MSFT", "REVENUE", "growth", "5y")=mxls_db_query("fundamental", "GOOGL", "NETINC", "avg", "3y")=mxls_db_query("fundamental", A1, B1, C1, D1)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.
