Excel Functions
  • 24 Oct 2024
  • 17 Minutes to read
  • Dark
    Light

Excel Functions

  • Dark
    Light

Article summary

Overview

ReportWORQ is designed to support all of Microsoft Excel's standard, built-in functions. ReportWORQ additionally supports several data provider-specific Excel functions which are documented, per data provider, in Datasources documentation.  

ReportWORQ does not support the use of Visual Basic for Applications or any other scripting languages, but it does include several ReportWORQ-specific Microsoft Excel functions that are designed to perform common reporting and data integration tasks that enhance its report distribution and data collection capabilities:

Data Provider-Specific ReportWORQ Functions

General Purpose ReportWORQ Functions

Data Collection

ReportWORQ supports several functions that are used to "writeback" data into configured data sources like SQL, Anaplan and Workday (specifically Standard Sheets, Modeled Sheets, and Adaptive Cube Sheets). These formulas are only available and executed when ReportWORQ receives a file for processing using a ReportWORQ Data Collection license.

ReportWORQ Data Collection Licensing

A ReportWORQ Server Data Collection license is required to use any of these functions and Data Collection features, in general. Please contact  Support if you have any questions about your current licensing entitlements for add-on features such as these.

Ranges and Tables

Several ReportWORQ-specific functions support a "Range or Table Name" parameter that is typically used when specifying a location for data to be output to, for instance in the RWSql or AIModeledExport functions. These parameters are used to target either a specific range or even Microsoft Excel tables with some of the following options: 

Reference Target

Description

Examples

Excel Table by Name

ReportWORQ will search for an Excel table with this name and repopulate the table with data for any table heading names that match data source column names. The table must have "Show Header Row" enabled. Please see a note below about referencing tables when bursting to multiple worksheets 

"Table 3"

Excel Table by Reference

When using a parameter to create multiple copies of a worksheet containing the Excel table you want to reference, it is not possible to reference the table name as a string because copies of it will get a new ID on each worksheet. Instead, you must:

  • Reference a cell in the data range of the table (not a column heading). 

  • Use the INDIRECT formula in any custom-calculated columns to make relative references to other values in the table's data. This is needed because when the worksheet is copied any formula references to the table will otherwise point to the wrong table.  For example, to reference the cell in the previous column:  =INDIRECT(ADDRESS(ROW(), COLUMN() - 1))

A2 

A2 in this example is the first data value in a table that spans A1:G15 and has the required header row enabled.



Single Row / Cell

ReportWORQ will populate data starting with the top left cell address, overwriting anything below and to the right of that cell.

B10

B:B

Multi-Row Range

ReportWORQ will clear and delete the range before inserting rows required to populate data, and will not overwrite anything below and to the right of that range.

A1:M30

B:Z

Workday Adaptive Planning

AIExtract

The AIExtract function is designed to extract a crosstab of data from Workday Adaptive Planning similarly to running a Web Matrix Report. The AIExtract function supports nesting dimensions on rows and/or columns and like web reports, the element selections can dynamically load children or descendant elements automatically.  

To provide maximum flexibility while leveraging native Excel & ReportWORQ features the matrix report generated by AIExtract is defined using a combination of 3 user-defined Excel Formulas that work together:

  1. The primary function, AIExtract, is used to indicate:

    • Where on the spreadsheet the data should be exported.

    • The dimension selections, including the axis and order they appear.

    •  Any options that apply to the report query.  

  2. Each dimension's element selections are defined using an AITier function. The AITier function is similar to dragging a selection in a Web Matrix Report and setting options for that selection. 

  3. The AIOption function is used to modify query options, such as zero suppression.

The sample report, available for download below, shows a report spec defined on the Spec worksheet using AIExtract, AITier, and AIOption functions. The resulting output is rendered on the Report worksheet. The report in the sample nests Levels and Accounts on Rows, with both dimensions fully expanded, and nests Versions and Time on Columns.  Versions is based on a static list of 2 versions and Time is dynamically expanded to Quarters.

AIExtract

The AIExtract function combines the AITier and AIOption functions into a report specification for extracting and then loading into a target cell range.

Syntax

AIExtract(Target Range, Tiers[, Options])

Parameter

Description

Target Range

The top left cell address where the report extract should be exported to. 

Tiers

A range of cells (or areas of ranges) that provide the AITier formulas for generating the report.

Options

An optional range of cells that provide the AIOption formulas for generating the report.

AITier

AITier functions define a dimension and selection on a report axis, as well as the nesting order on the axis. Each AITier formula must be placed on an Axis where the dimension element selection can be set to none, children to dynamically expand to children or descendants to fully expand each element. Multiple AITier formulas for the same dimension can be defined so long as they appear on the same axis, which is useful when a mix of expanded and collapsed elements is required.

Syntax

AITier(Axis, Dimension, Selection, Depth, Order)

Parameter

Description

Axis

The name of the axis for this selection:

  • Rows

  • Columns

  • Filters

Dimension

The name of the dimension for this selection, e.g. Versions, Time, Levels.

Selection

Element selections can be defined as:

  • A semi-colon delimited list of element names to include. 

  • A reference to a range of cells that contain element names (see row 5 in the example file)

Depth

The hierarchy depth to expand each element in Selection, which can be one of these options:

  • None

  • Children 

  • Descendants

Order

The order for this tier on the axis, moving from outer to inner.

AIOption

The AIOption function is used to provide global options for the report query, such as autoformatting and zero suppression.

Syntax

AIOption(name, value)

Parameter

Description

Name

The name of one of the supported options (see below).

Value

The value for that specific option.

Supported Options

Name

Description

Values

Default

suppresszeros

Suppress zero rows / columns

0: none, 1: suppress rollups, 2:supress zeros

0

suppressrollups

Suppress automatic rollups

TRUE, FALSE

FALSE

autoformat

Automatically format the report:

  • Bold formats on column and row headers 

  • Autofit column widths

TRUE, FALSE

TRUE

AIModeledExport

The AIModeledExport function exports data from a Modeled Sheet into an Excel Range or Table. This formula is typically used in concert with the AIModeledInput formula, defined in a calculated column, to distribute input forms to users who need to provide minor updates to a portion of a Modeled Sheet.  

AIModeledExport options are modeled after parameters in the Adaptive exportConfigurableModelData API  function.

Syntax

AIModeledExport( Range or Table Name, Version, Adaptive Sheet Name, [Start Period], [End Period], [Levels], [Include Descendants])

Parameter

Description

Range or Table Name

A reference to an Excel table or a cell range. See Excel Ranges or Table Names for more information.

Version

The name of the Adaptive Version to export the data from. For example 'Budget'.

Adaptive Sheet Name

The name of the Adaptive Modeled Sheet to export data from.  For example 'Personnel'.

Start Period

Optional name of a starting leaf period.

End Period

Optional name of an ending leaf period.

Levels

Optional pipe-delimited list of levels to export.

Include Descendants

Optional flag to also include descendants for the specified Levels.

Examples

Formula

Description

=AIModeledExport("Table 4", "Budget", "Personnel")

Export the "Personnel" Modeled Sheet for the "Budget" version to the table named "Table 4".

=AIModeledExport("Table 4", "Budget", "Personnel", , , "East")

Export the "Personnel" Modeled Sheet for the "Budget" version to the table named "Table 4", including only the "East" level.

=AIModeledExport("Table 4", "Budget", "Personnel", "Jan-2020", "Dec-2020", "East|West", TRUE)

Export the "Personnel" Modeled Sheet for the "Budget" version for all months between Jan-2020 and Dec-2020 to the table named "Table 4", including only the "East" and "West" levels and their descendants.

AIInput

The AIInput formula adds the ability to write a value back to a Workday Adaptive Planning Standard or Cube Sheet.  This formula references a cell that is linked to an Adaptive cube value as part of an OfficeConnect Excel report, by referencing an Adaptive OfficeConnect cell, ReportWORQ will automatically use that cell's intersection when writing back into the planning system.  The AIInput formula also supports providing the intersection information directly in the cell as pairs of Dimension and Element selections. By supplying the intersection information directly in the formula, the user can leverage Excel functionality to dynamically adjust the intersection based on other formulas.

Important

This formula will only work if the report is distributed using ReportWORQ and if the cell referenced was originally a value loaded from Workday Adaptive Planning.

Syntax - Referencing an OfficeConnect cell

AIInput(Value Range, [Adaptive Sheet Name])

Parameter

Description

Value Range

A reference to a cell that was originally loaded from Adaptive when ReportWORQ created the output file.

Adaptive Sheet Name

Optional cube sheet to import the data into when referencing cube sheets.

Examples

Formula

Description

=AIINPUT(D10)

Reference an existing Adaptive OfficeConnect Standard Sheet cell that was distributed with ReportWORQ

=AIINPUT(D10, "New Premiums")

Reference an existing Adaptive OfficeConnect Cube Sheet cell that was distributed with ReportWORQ.

Syntax - Providing intersection information

AIInput(Value Range, [Adaptive Sheet Name], "Dimension|Element", ["Dimension|Element"], ["Dimension|Element"], etc.)

Parameter

Description

Value Range

A reference to a cell that was originally loaded from Adaptive when ReportWORQ created the output file.

Adaptive Sheet Name

Optional cube sheet to import the data into when referencing cube sheets.

Dimension|Element Pair

A string specifying the dimension name and element name separated by a pipe. E.g. "Versions|budget" or "Period|Jan-2023"

Dimension|Element Pair


Provide as many Dimension|Element pairs as required to identify the unique input intersection

Examples

Formula

Description

=AIINPUT(D10, "New Premiums", "Versions|Budget", "Accounts|Quotes", "Levels|NJ", "Time|Jan-2023")

Reference an input cell and manually provide the tuple intersection information


AIModeledInput

The AIModeledInput formula provides the ability to write a value back to a Workday Adaptive Planning Modeled Sheet. This formula uses the importConfigurableModelData Adaptive API and the rules of that API method will apply to this formula.  The AIModeledInput formula is typically defined in a calculated column in an Excel table that is updated during report distribution using the AIModeledExport formula. These formulas are designed to work hand in hand with input form distribution for users who need to provide minor updates to a portion of a Modeled Sheet.

Syntax

AIModeledInput(Version, Adaptive Sheet Name, Import Key Name, Import Key Value, Input Column Name, Input Value)

Parameter

Description

Version

The name of the Adaptive Version to load the data to. For example, Budget. 

Adaptive Sheet Name

The name of the Adaptive Modeled Sheet to import data into.  For example, Personnel. 

Import Key Name

The name of the dimension to use as an Import Key for updates. For example, EmployeeId. 

Import Key Value

The dimension element to uniquely identify this row for updating. For example, John Snow. 

Input Column Name

The name of the column in the Modeled Sheet to update. For example, Salary. 

Input Value

The value to update in the Modeled Sheet for the specified input column, item (as defined by Import Key Name + Value), and version.

SQL

RWSQL

The RWSQL function is used to return data to an Excel spreadsheet from an ODBC or OLE DB data source using a named ReportWORQ data source connection and SQL query.

Syntax

RWSQL( Range or Table Name, Connection Name, SQL Query)

Parameter

Description

Range or Table Name

A reference to an Excel table or a cell range. See Excel Ranges or Table Names for more information. 

Connection Name

The name of an existing ODBC or OLE DB Connection that is defined in ReportWORQ, which will be used to retrieve data for the RWSQL formula. For more information on the configuration of these connections, please see Datasources -> SQL Sources.

SQL Query

The query to execute against the datasource provider. The query must only return a single dataset.

SQL Query Tips

The SQL Query can be dynamically constructed using Excel formulas and adjusted using ReportWORQ parameters.  For example, the query may be ="SELECT * FROM SALES_FORCAST WHERE REP='" & $A$4 &"' ". Where cell A4 is the name of the sales rep provided by a ReportWORQ parameter.

Note that longer SQL statements may reach a character cell limit in Excel. To avoid the limit, the query may need to be divided into multiple cells and concatenated in a cell that is then referenced by the RWSQL formula.

Examples

Note that all examples below are based on a SQL Datasource connection named "SampleData" in ReportWORQ.

Formula

Description

=RWSQL( "Table 4", "SampleData", "Select * FROM Stores")

Export all data from the "Stores" database table/view to the Excel table named "Table 4", matching data in fields based on Excel table column name.

=RWSQL( A2, "SampleData", "Select * FROM Stores")

2 Possible Results:

  • Export all data from the "Stores" database table to cell A2, overwriting any existing data to the right and below that cell.

  • If A2 is within an existing Excel table then update in the manner described in the named "Table 4" example.

=RWSQL( A2:D10, "SampleData", "Select * FROM Stores")

Export all data from the "Stores" database table to the range A2:D10, clearing and resizing that range to fit the query result.

RWSQLUPDATE/RWSQLUPSERT

The RWSQLUPSERT & RWSQLUPDATE functions are both designed to update data in a single record of a relational database table when using the Data Collection capabilities of ReportWORQ and a valid ODBC or OLE DB SQL database connection. The differences between the functions are:

  • RWSQLUPDATE: can only update an existing record.

  • RWSQLUPSERT: can both insert and update a record.

Both functions require the following information:

  • The name of the saved SQL database connection in ReportWORQ.

  • The table name being updated.

  • A way to uniquely locate the record:

    • The name of an Id column.

    • The value to search for in that Id column.

  • A minimum of 1 column name/value combination indicating the value(s) to update in that record.

These functions will fail to update data if the ReportWORQ connection credentials do not have write access to the table or:

  • RWSQLUPDATE, RWSQLUPSERT: The Id Column lookup returns more than one record.

  • RWSQLUPDATE: The Id Column lookup returns no records.

Syntax

RWSQLUPDATE / RWSQLUPSERT ( Connection Name, Table Name, Id Column Name, Id Column Value, Column Name / Value List )

Parameter

Description

Connection Name

The name of an existing ODBC or OLE DB Connection that is defined in ReportWORQ, which will be used to update data using the RWSQLUPDATE formula. This connection must have WRITE access to the specified Table Name. For more information on the configuration of these connections, please see Datasources -> SQL Sources

Table Name

The name of the table being updated.  For example, TimeEntry. 

Id Column Name

The name of the column that is used to uniquely search for a single record in the table. For example, EmployeeIdAndPeriod.

Id Column Value

The value is used to uniquely identify the row in the Id Column for updating. For example,  John Snow_20220108. 

Column Name / Value list

A minimum of one combination of table Column Name and Column Value which are to be updated by the SqlUPDATE function. For an example, see the highlighted section of the following formula:


=RWSQLUPDATE("MySqlDatabase", "TimeEntry", "EmployeeIdAndPeriod", "John Snow_20220108", "Hours", 12, "Comments", "Generated Report Packages without ReportWORQ")

ANAPLANINPUT

The ANAPLANINOUT formula provides the ability to write a value back to an Anaplan cube. The ANAPLANINOUT formula is typically defined in an Excel report that is generated as an input template by ReportWORQ to collect data from users who, for instance, need to only provide minor updates to a portion of a cube.

Syntax

ANAPLANINOUT( Input Row, Input Column, Input Value )

Parameter

Description

Input Row

The index of the row being updated.

Input Column

The index of the column being updated.

Input Value

The value to update at this Input Row and Column location.

General Purpose

RWPAGEBREAK

The RWPAGEBREAK function is used to manually toggle page breaks on rows or columns, based on a user-defined conditional expression. Page breaks are activated at the location of the function when the Enable parameter is TRUE, for instance when a specific heading is detected in data that indicates a need to insert a break in rows or columns. The Direction field indicates whether a vertical (columns) or horizontal (rows) page break is inserted.

Syntax

RWPAGEBREAK( Enable, [Direction] )

Parameter

Description

Enable

Whether or not to insert a page break in the row or column (defined by Direction) where the RWPAGEBREAK function is located. This is typically a formula that references a value in the report indicating a new section.

Direction

Permitted values for Direction are:

  • TRUE or "Horizontal" for row page breaks

  • FALSE or "Vertical" for column page breaks

The default value for this optional parameter, if omitted, is "Horizontal".

Position

This 3rd argument is optional and indicates if the pagebreak should be before or after the row/column number.

  • If omitted the pagebreak will occur before the current row/column

  • If set to true or the word “Before” the pagebreak will occur before the current row/column 

  • If set to false or the word “After” the pagebreak will occur after the current row/column 

If the Excel fit to page option for height or width is set to a positive number (anything other than Automatic) then RWPAKEBREAK formula will throw a warning when used for horizontal or vertical pagebreaks respectively.


Important Notes about Page Breaks with RWPAGEBREAK

When the Enable parameter is TRUE a page break will be inserted just ABOVE the row containing RWPAGEBREAK(for "Horizontal" breaks) or to the LEFT of the column containing RWPAGEBREAK(for "Vertical" breaks). 

This feature also DOES NOT remove or replace any existing page breaks defined in your Excel workbooks.


Examples

Example Formulas Note

For illustrative purposes, all RWPAGEBREAK formula examples are located in cell N40.

Formula

Description

=RWPageBreak ( TRUE )


=RWPageBreak( TRUE, TRUE )


=RWPageBreak ( TRUE, "Horizontal")

Inserts a horizontal page break at the boundary between row 39 and 40.

=RWPageBreak( TRUE, FALSE)


=RWPageBreak ( TRUE, "Vertical")

Inserts a vertical page break at the boundary between column M and N.

=RWPageBreak( FIND("Summary", $B40)=1, "Horizontal")

Inserts a horizontal page break at the boundary between row 39 and 40 if the value in cell B40 contains the text "Summary", which would indicate a heading and page break boundary.


=RWPageBreak( TRUE, TRUE, FALSE )


=RWPageBreak( TRUE, TRUE, "After" )


Inserts a horizontal page break after row 40


RWRESIZE

The RWRESIZE function performs an autofit to data operation on the row or column containing the RWRESIZE function. This is most often used to resize columns to avoid a ##### display when a cell is not large enough to display a numeric value. RWRESIZE has special support for Merged Cells. If an RWRESIZE formula is located in a merged cell then the resize operation will be performed on the group of rows or columns in the cell's range and the height or width will be distributed equally. The RWRESIZE will not perform its operation if the row or column it is acting on is hidden. 

Syntax

RWRESIZE( [Axis], [Pad] )

Parameter

Description

Axis

Permitted values for Axis are:

  • TRUE or "rows" for auto-fit row heights.

  • FALSE or "columns" to autofit column widths.

The default value, if omitted, is TRUE / "rows".

Pad

Optional additional height or width to add to the autofit algorithm. This can be useful when certain formatting situations still result in too small of a resize to display the cell value, or when additional spacing between report rows or columns is desired. The value is represented in points.

Examples

Formula

Description

=RWResize()


=RWResize( TRUE )


=RWResize( "rows" )

Resizes the row's height to auto-fit to data in the row's cells.

=RWResize( FALSE )


=RWResize( "columns" )

Resizes the column's width to auto fit to data in the row's cells.

=RWResize( "columns", 2 )

Resizes the columns width to auto fit to data, and adds 2 additional points to that width.

RWSORT

The RWSORT function will sort a specified range of data based on up to 3 sort keys, each optionally specifying a sort ascending or descending option.

Syntax

RWSORT( Range or Table Name, [Sort Column 1], [Sort Order 1], [Sort Column 2], [Sort Order 2], [Sort Column 3], [Sort Order 3] )

Parameter

Description

Range or Table Name

A reference to an Excel table or cell range that represents the data to be sorted. See Excel Ranges or Table Names for more information. 

Sort Column 1, Sort Column 2, Sort Column 3

Optional Sort Column parameters are an integer index indicating which column to sort in the specified range or table. 1 for the first column, 2 for the second, etc.


The default column is 1.

Sort Order 1, Sort Order 2, Sort Order 3

Optional Sort Order parameters indicate the sort direction for a corresponding Sort Column:

  • TRUE: Ascending order

  • FALSE: Descending order

The default sort order is TRUE (ascending).

Examples

Formula

Description

=RWSORT(A1:D30)


=RWSORT(A1:D30, 1, TRUE)

Sorts data in the range A1:D30 based on the first column in ascending order.

=RWSORT("Table 1")


=RWSORT("Table 1", 1, TRUE)

Sorts data in the Excel table named "Table 1" based on the first column in ascending order.

=RWSORT(A1:D30, 1, TRUE, 3, TRUE)

Sorts data in the range A1:D30 based on the first column in ascending order, followed by the third column in ascending order.

=RWSort("Table1", 1, TRUE, 2, TRUE, 3, FALSE)

Sorts data in the Excel table named "Table 1" based on the first column in ascending order, then by the second column in ascending order, followed by the third column in descending order.

RWSUPPRESS

The RWSUPPRESS function is used to enable custom suppression of rows and/or columns. Suppression can hide or delete the row/columns based on the condition in the Enable parameter. While this function is typically used to check for zero or blank values (zero suppression), any expression can be used. For example, combing RWSUPPRESS with RWSORT would allow you to rank data in order and then keep only the top n rows.

RWZERO -> RWSUPPRESS

The RWZERO function was renamed RWSUPPRESS to better reflect its broad usage. The RWZERO function will continue to be supported for legacy reasons.

Syntax

RWSUPPRESS( Enable, [Axis], [Mode] )

Parameter

Description

Enable

Provide a TRUE or FALSE to enable suppression for this row or column. This is often a formula that performs a zero check. For example, SUMSQ(3:3)=0. 

Axis

Optional parameter that defines whether the row or column of the cell containing the RWSUPPRESSformula is to be suppressed when Enable is TRUE. Valid parameter values are:

  • TRUE or "rows" to suppress the row.

  • FALSE or "columns" to suppress the column.

The default axis is "rows".

Mode

Optional parameters that define the suppress mode when Enable is TRUE:

  • TRUE or "delete": Deletes the row/column.

  • FALSE or "hide": Hides the row/column.

The default mode is "delete".

Examples

Formula

Description

=RWSUPPRESS(FALSE)

Does nothing to the current row.

=RWSUPPRESS(TRUE)


=RWSUPPRESS(TRUE, TRUE, TRUE)

Delete the current row.

=RWSUPPRESS(TRUE, FALSE)


=RWSUPPRESS(TRUE, "columns", "delete")

Delete the current column.

=RWSUPPRESS(TRUE, "rows", FALSE)

Hide the current row.

=RWSUPPRESS(TRUE, "columns", "hide")

Hide the current column.


Was this article helpful?