YEARLESS_DATE_IN_RANGE

Checks if the day and month of a date fall within a date range

Formula definition
=AND(
    OR(
      DATE(YEAR(start_date), MONTH(date_to_check), DAY(date_to_check)) >= start_date, 
      DATE(YEAR(end_date), MONTH(date_to_check), DAY(date_to_check)) >= start_date
    ),
    OR(
      DATE(YEAR(start_date), MONTH(date_to_check), DAY(date_to_check)) <= end_date, 
      DATE(YEAR(end_date), MONTH(date_to_check), DAY(date_to_check)) <= end_date
    )
  )
  

Function details

This function checks if the month and day of a date fall within a date range, regardless of the year. It's ideal for tracking events like anniversaries or yearly deadlines that recur on the same day. For example, to see if March 1st is between November 1, 2024, and December 31, 2024, you would use "=YEARLESS_DATE_IN_RANGE(A1, B1, C1)", where A1 holds March 1st, B1 is November 1, 2024, and C1 is December 31, 2024. This function ensures that annual events are recognized even when they span different years.

Use the inputs below to create YEARLESS_DATE_IN_RANGE as a reusable custom function in Google Sheets.

Learn how to add custom functions to Google Sheets
Function name

YEARLESS_DATE_IN_RANGE

Function description

Checks if the day and month of a date fall within a date range

Formula definition

=AND( OR( DATE(YEAR(start_date), MONTH(date_to_check), DAY(date_to_check)) >= start_date, DATE(YEAR(end_date), MONTH(date_to_check), DAY(date_to_check)) >= start_date ), OR( DATE(YEAR(start_date), MONTH(date_to_check), DAY(date_to_check)) <= end_date, DATE(YEAR(end_date), MONTH(date_to_check), DAY(date_to_check)) <= end_date ) )

Argument placeholder

date_to_check

Argument placeholder

start_date

Argument placeholder

end_date

Argument details

Argument description (date_to_check)

The original date being checked

Argument example (date_to_check)

A1

Argument description (start_date)

The start date of the period within which the date is checked.

Argument example (start_date)

B1

Argument description (end_date)

The end date of the period within which the date is checked.

Argument example (end_date)

C1

Related functions

Other functions in the same category: Date & Time Operations

What is a named function in Google Sheets?

Named functions enable the creation of custom, reusable formulas that mimic built-in functions, streamlining calculations and data manipulations. These functions simplify complex formulas, making spreadsheets more readable and less prone to errors. By encapsulating intricate logic within a single function call, they enhance consistency across your data. Utilizing named functions reduces the need to write lengthy formulas repeatedly, thereby improving workflow efficiency and productivity in data analysis and management.

How to add custom functions to Google Sheets

Quick & dirty method

Download and import — fastest way to add the function but does not include argument descriptions and examples

Follow these simple steps to download and import a function into your spreadsheet. This method is the quickest and easiest way to add the named function to your Google Sheets document, but will not include the argument description and examples.

  1. 1
    Download the formula: Click on the download button next to the function to download a file with the formula.
  2. 2
    Open Google Sheets: Open your Google Sheets document, from the top menu select Data > Named functions. Click Import function.
  3. 3
    Import the function: Select Upload and select the file you downloaded with the function. Click Import all or select which function(s) to import and click Import.

Once added, the function will be ready to use in your document like any other built-in function. Simply type the function name and provide the required inputs to use it in your calculations.

Manual & detailed method

Copy and paste — copy and paste each property one at a time

Follow these simple steps to integrate a custom named function into your spreadsheet:

  1. 1
    Open Google Sheets: Open your Google Sheets document, from the top menu select Data > Named functions. Click Add new function.
  2. 2
    Enter the function details: For each input copy and paste the information for the function.
    • Copy the name of the function to the Function name input.
    • Copy the description of the function to the Function description input.
    • Copy each placeholder one at a time into the Argument placeholders input, if there are any placeholders.
    • Copy the formula of the function to the Formula definition input.
    Click Next.
  3. 3
    Add additional details: Optionally you can add a description and example for the placeholders.
  4. 4
    Save the function: Click Create to add the function to your document.

Once added, the function will be ready to use in your document like any other built-in function. Simply type the function name and provide the required inputs to use it in your calculations.

Tips

  • If you import a named function that has the same name as a named function that already exists in your active file, the imported one will override the existing named function.
  • If the named function that you selected to import depends on another named function, like formula definition, Google Sheets will warn you about that dependency and highlight the dependent functions.
  • If the named function that you selected to import uses a formula that interacts with an external source, like IMAGE, Google Sheets will warn you about that interaction.