DATE_CLOSEST function

The Klipfolio DATE_CLOSEST function lets you find the closest day of the week before or after a given date.

The syntax for the DATE_CLOSEST function is:

DATE_CLOSEST( values , dow , direction, timezone )

Parameters

values The starting date. scalar
dow Day of the week.  Options include: Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday. scalar
direction The direction.  Options include forward or backward. scalar
timezone Optional
to specify timezone using regional time zone or offset
scalar

DATE_CLOSEST example

Let's look at a DATE_CLOSEST function example.

 

A

1 6/6/14

The following example is based on the above text from an Excel spreadsheet:

DATEVALUE( DATE_CLOSEST( DATE( A1 , "M/d/yy" ) , Monday , backward ) , "d-MMM-yyyy" )   

-> [2-Jun-2014]

Related links: