XL3TableArrayLookup

Revision as of 10:59, 8 September 2017 by Colin (talk | contribs) (Created page with "Returns the result of a SQL query as an array. This is a [https://support.office.com/en-gb/article/Guidelines-and-examples-of-array-formulas-7d94a64e-3ff3-4686-9372-ecfd5caa57...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Returns the result of a SQL query as an array. This is a CSE/Array formula so must be entered into a range at once using Ctrl+Shift+Enter.

This is the fastest way to return database results into Excel, but limits your options for altering the query.

Syntax

XL3TableArrayLookup( Connection, Sql, [HeaderHandling] )

Parameters

Parameter Description
Connection Connection number to use
Sql The query to run. Typically from a cell so that the query can be updated.
HeaderHandling Optional, how to output headers
0/Missing Headers not displayed
1 Headers displayed

Example

Here we have our SQL statement in cell A1. We select the range we want to output the results to, and type

Then press Ctrl+Shift+Enter.

Xl3tablearraylookup.png

Note that any cells outside of the data area return #N/A. The date column has also been formatted.

See Also