Skip to main content

Creating a formula to filter for a date range as well as a check box

  • September 24, 2021
  • 3 replies
  • 33 views

I’m looking for help to write a formula that will help filter records that meet these requirements. I can’t seem to get it done using the filter function.

Where date is within the next week
or
Where date is within the last 3 days
and
Where check box is not marked

3 replies

Forum|alt.badge.img+2
  • Inspiring
  • September 24, 2021

Hi and welcome to Airtable!

Do you mean literaly within the next week, like within week 39 now, or do you mean within the next 7 days?


Forum|alt.badge.img+2
  • Inspiring
  • September 24, 2021

Try this:

IF( 
  OR(
    DATETIME_FORMAT(Date, 'W') = DATETIME_FORMAT( DATEADD(Today(), 1, 'weeks') , 'W'),
    And(
      IS_BEFORE(Date, Today()),
      IS_AFTER(Date, DATEADD(Today(), -4, 'days')),
      Checkbox = 1
    )
  ),
"Meets criteria",
"Don't meet criteria"
)

  • Author
  • New Participant
  • October 4, 2021

Try this:

IF( 
  OR(
    DATETIME_FORMAT(Date, 'W') = DATETIME_FORMAT( DATEADD(Today(), 1, 'weeks') , 'W'),
    And(
      IS_BEFORE(Date, Today()),
      IS_AFTER(Date, DATEADD(Today(), -4, 'days')),
      Checkbox = 1
    )
  ),
"Meets criteria",
"Don't meet criteria"
)

Thank you so much - I actually figured out a way to force it to work by reordering the filters!