The Datarails Excel Add-In: Date Ranges in Formulas

Formulas in the Datarails Flex Add-In are powerful tools that allow you to extract and manipulate data efficiently. They consist of three main components: functions, fields, and values. Functions define the calculations to be performed, fields specify the data source, and values provide the specific criteria or filters for the data.

Date ranges can be included as part of the value, enabling you to filter and extract data for specific periods or ranges, enhancing flexibility and precision in your data workflows. Below is a comprehensive guide to using date ranges in formulas.

DR.RANGE

DR.RANGE defines a range of dates, whole numbers or decimal numbers for use inside a DR.GET formula. It cannot be used with text or boolean (true/false) data types.

Syntax - DR.RANGE(Value1, Value2)

Examples

Required rangeSyntax
Dates between 01/01/2024 and 12/31/2024DR.RANGE(DR.DATE("01/01/2024"), DR.DATE("12/31/2024"))
Accounts between 4000 and 5000DR.RANGE(4000, 5000)
Excel cell range A2 to A5DR.RANGE(A2, A5)

Note: with hard-coded dates you must wrap each date in DR.DATE. With Excel cell references, DR.DATE is not needed.

Using DR.RANGE inside DR.GET

The syntax to retrieve the value of a field using a date range is as follows:
To fetch the value of the Amount field for dates between 1 January 2024 and 31 December 2024:

DR.GET(Amount, "[Reporting Month]", DR.RANGE(DR.DATE("01/01/2024"), DR.DATE("12/31/2024")))


Using the reference date in formulas

As well as referencing specific cells, you can reference the reference date, so changing it moves the whole report with it.
 The Reference Date is a tool that sets the reference date for your reports, making them dynamic by allowing you to adjust the reporting period directly within your Excel workbook. The Reference Date serves as your guide for selecting and changing the report's date, enabling you to work through historical periods or the most recent data available. It allows you to choose from various time dimensions, including: day, week, month, quarter and year.

By selecting a time dimension and referencing it in your formula, changing the Reference Date will dynamically update the formula's output.

Example

To bring in data for a month relative to the reference date:

DR.GET(Amount, "[Reporting Month]", EOMONTH(DR_REFERENCE_DATE, -3))
a formula referencing the reference date, three months back

The older name still works. Files built before the rename use DR_DATE_PICKER, and the add-in keeps both names pointing at the same date, so existing formulas keep working. Use DR_REFERENCE_DATE in anything new.

Working across platforms

Date ranges behave identically on Windows desktop, Mac desktop and Excel on the web.




© Datarails Ltd. All rights reserved.

Updated

Was this article helpful?

0 out of 0 found this helpful

Have more questions? Submit a request

Comments

0 comments

Please sign in to leave a comment.