InDateRange

The InDateRange function determines if an inputted date is within a specified range of dates, returning True or False.

Syntax

InDateRange([date column], [direction], [period], [length], [offset], [today])

Function arguments:

  • date column (required) - The date to be evaluated.
  • direction (required) - The direction to apply the date range offset.
    • Enter last to set the date range to the most recent window.
    • Enter next to set the date range to the upcoming window.
    • Enter current to set the date range to the current window.
    • Enter to_date to set the date range to the current window up until the current date. 
  • period (required) - The size of date window
    • options: year, quarter , month, week, day, hour, minute , and second
  • length (optional) - The number of periods to include in the date range
    • If not set, defaults to 1
  • offset (optional) - The number of periods to offset for the start date range
    • If not set, defaults to 0
  • today (optional) - The value to use for Today when calculating with respect to the current date
    • If not set, defaults to Today()

Example

Returns True for all dates in the current month:

InDateRange([Date], "current", "month")

Returns True for all dates in the last three weeks:

InDateRange([Date], "last", "week", 3)

Returns True for all dates in the week starting three weeks ago:

InDateRange([Date], "last", "week", 1, 3)

Returns True for all dates within the last year up to today's date:

InDateRange([Date], "to_date", "year", 1, -1)

Related resources