Blog

Airtable: Dynamic Date Comparison in Find Records Automation

FE
Filla EditorialintermediateNov 22, 2025

Dynamic date comparison in Find Records

Airtable's "Find Records" action doesn't support dynamic date comparisons like "Date < trigger record's date". Convert dates to milliseconds using a formula field to enable dynamic date filtering.


The problem

You want to find records where a date field is before (or after) the triggering record's date, but Airtable's Find Records action doesn't support dynamic date comparisons.

Example scenario:

  • You have a "Social Media Metrics" table
  • Each record needs to link to all previous records for the same Contact/Platform
  • Only records where "Date Recorded" is before the current record's date should be linked
  • Find Records can't do: Date Recorded < {trigger record's Date Recorded}

Why it fails: Find Records requires static values or field references, but can't compare one record's date to another record's date dynamically.


The solution: Convert dates to milliseconds

Convert your date field to milliseconds using a formula field, then filter on the numeric value.

Step 1: Create a formula field

Add a formula field that converts the date to milliseconds:

VALUE(DATETIME_FORMAT({Date Recorded}, 'x'))

Or the simpler version:

DATETIME_FORMAT({Date Recorded}, 'x') + 0

How it works:

  • DATETIME_FORMAT(date, 'x') formats the date as Unix timestamp in milliseconds
  • VALUE() or + 0 converts the string to a number
  • Result: A numeric field you can use in Find Records comparisons

Complete example: Link previous records

Scenario: Social Media Metrics

You want each record to automatically link to all previous records (same Contact/Platform) where the date is earlier.

Step 1: Create the milliseconds field

Field name: Date as Milliseconds

Formula:

VALUE(DATETIME_FORMAT({Date Recorded}, 'x'))

This creates a numeric field like 1734567890000 (milliseconds since Unix epoch).

Step 2: Set up the automation

Trigger: When a record is created or updated

Action 1: Find Records

  • Table: Social Media Metrics
  • Filter conditions:
    • Contact = {Trigger Record's Contact}
    • Platform = {Trigger Record's Platform}
    • Date as Milliseconds < {Trigger Record's Date as Milliseconds}

Action 2: Update Record

  • Update the trigger record
  • Link the found records to a "Previous Records" field

Step 3: Use rollups to get previous month's data

After linking previous records, use a rollup to get the previous month's follower count:

Rollup field: Previous Followers

  • Source: Previous Records (linked records)
  • Field: Follower Count
  • Formula: MAX(values) (or use date logic to get the most recent)

Step 4: Calculate growth

Formula field: Growth %

IF(
  {Previous Followers} > 0,
  ({Follower Count} - {Previous Followers}) / {Previous Followers} * 100,
  0
)

Format as percentage.


How it works

Date to milliseconds conversion

VALUE(DATETIME_FORMAT({Date Recorded}, 'x'))

Example:

  • Date: 2024-11-20 10:30:00
  • Milliseconds: 1732102200000

Comparison in Find Records

Now you can compare:

  • Date as Milliseconds < {Trigger Record's Date as Milliseconds}

This finds all records where the date is earlier than the trigger record's date.


Common use cases

Use case 1: Link previous records

Goal: Link each record to all records with earlier dates

Setup:

  1. Formula field: VALUE(DATETIME_FORMAT({Date}, 'x'))
  2. Automation Find Records:
    • Date as Milliseconds < {Trigger's Date as Milliseconds}
    • Plus any other matching criteria (Contact, Platform, etc.)

Use case 2: Find records within date range

Goal: Find records between two dates

Setup:

  1. Formula fields:
    • Start Milliseconds: VALUE(DATETIME_FORMAT({Start Date}, 'x'))
    • End Milliseconds: VALUE(DATETIME_FORMAT({End Date}, 'x'))
  2. Automation Find Records:
    • Date as Milliseconds >= {Trigger's Start Milliseconds}
    • Date as Milliseconds <= {Trigger's End Milliseconds}

Use case 3: Find most recent record before date

Goal: Find the most recent record before a specific date

Setup:

  1. Formula field: VALUE(DATETIME_FORMAT({Date}, 'x'))
  2. Automation Find Records:
    • Date as Milliseconds < {Trigger's Date as Milliseconds}
    • Sort by: Date as Milliseconds (descending)
    • Limit: 1 record

Use case 4: Calculate month-over-month growth

Goal: Automatically calculate growth percentage

Setup:

  1. Milliseconds field for date comparison
  2. Automation to link previous records
  3. Rollup to get previous month's value
  4. Formula to calculate growth

Step-by-step: Complete automation

Automation: Link Previous Metrics

Trigger: When record is created or updated

  • Table: Social Media Metrics
  • Condition: Date Recorded is not empty

Action 1: Find Records

  • Table: Social Media Metrics
  • Filter:
    • Contact = {Trigger Record's Contact}
    • Platform = {Trigger Record's Platform}
    • Date as Milliseconds < {Trigger Record's Date as Milliseconds}
    • Date Recorded is not empty

Action 2: Update Record

  • Record: Trigger record
  • Field: Previous Records (linked record field)
  • Value: Found records

Result: Each new record automatically links to all previous records for the same Contact/Platform combination.


Advanced: Getting the most recent previous record

If you only need the immediate previous record (not all previous records):

Option 1: Use MAX in rollup

After linking all previous records, use a rollup:

Rollup field: Previous Month Followers

  • Source: Previous Records
  • Field: Follower Count
  • Formula: MAX(values) (if you have a date-based rollup)

Option 2: Sort and limit in Find Records

Action: Find Records

  • Same filters as above
  • Sort by: Date as Milliseconds (descending)
  • Limit: 1 record

This finds only the most recent previous record.


Troubleshooting

Milliseconds field shows empty

Problem: Formula returns empty for some records.

Solution: Check that the date field has values:

IF(
  {Date Recorded},
  VALUE(DATETIME_FORMAT({Date Recorded}, 'x')),
  0
)

Comparison not working

Problem: Find Records isn't finding records even though dates should match.

Check:

  1. Both records have the milliseconds field populated
  2. The milliseconds field is a number field (not text)
  3. Filter conditions are correct
  4. Other filter conditions (Contact, Platform) are matching

Performance with many records

Problem: Automation is slow with many records.

Solutions:

  • Add additional filters to narrow the search (Contact, Platform, etc.)
  • Consider using scripts for complex logic
  • Use external tools (Make, Zapier) for heavy processing

Alternative approaches

Manual linking

Pros: Simple, works immediately
Cons: Not scalable, requires manual work

MIN/MAX rollup pattern

Pros: Works with formulas
Cons: Still requires linking step first

External tools (Make, Zapier)

Pros: More flexible, handles complex logic
Cons: Requires external service, additional cost

Scripting

Pros: Full control, can handle complex logic
Cons: Requires coding knowledge, maintenance overhead

Recommendation: Use the milliseconds approach for native Airtable solutions. It's elegant, scalable, and works entirely within Airtable.


Best practices

Always include the milliseconds field

Create the milliseconds formula field when you set up date-based automations. It's a small overhead that enables powerful filtering.

Use descriptive field names

Name your milliseconds field clearly:

  • Date as Milliseconds
  • Created Time Milliseconds
  • Milliseconds (too generic)

Combine with other filters

Always combine date comparisons with other relevant filters:

  • Same Contact
  • Same Platform
  • Same Category
  • etc.

This improves performance and ensures accurate results.

Test with sample data

Before deploying:

  • Test with a few records
  • Verify dates are being compared correctly
  • Check edge cases (first record, same date, etc.)

Quick reference

Goal Formula Find Records Filter
Convert date to milliseconds VALUE(DATETIME_FORMAT({Date}, 'x')) N/A
Find records before date N/A Date as Milliseconds < {Trigger's Date as Milliseconds}
Find records after date N/A Date as Milliseconds > {Trigger's Date as Milliseconds}
Find records between dates N/A Date as Milliseconds >= {Start} AND Date as Milliseconds <= {End}

Complete working example

Table: Social Media Metrics

Fields:

  • Date Recorded (Date & time)
  • Date as Milliseconds (Formula): VALUE(DATETIME_FORMAT({Date Recorded}, 'x'))
  • Contact (Single select)
  • Platform (Single select)
  • Follower Count (Number)
  • Previous Records (Linked records)
  • Previous Followers (Rollup): MAX(values) from Previous Records
  • Growth % (Formula): IF({Previous Followers} > 0, ({Follower Count} - {Previous Followers}) / {Previous Followers} * 100, 0)

Automation: Auto-Link Previous Records

Trigger: When record is created

  • Table: Social Media Metrics

Action: Find Records

  • Table: Social Media Metrics
  • Filter:
    • Contact = {Trigger Record's Contact}
    • Platform = {Trigger Record's Platform}
    • Date as Milliseconds < {Trigger Record's Date as Milliseconds}

Action: Update Record

  • Record: Trigger record
  • Field: Previous Records
  • Value: Found records

Result: Every new record automatically links to previous records and calculates growth percentage.


Tips

  • Use milliseconds conversion for any dynamic date comparison in automations
  • Combine with other filters to narrow results and improve performance
  • Test thoroughly with sample data before deploying
  • Document your setup so team members understand the logic
  • Consider edge cases like first records, duplicate dates, etc.

References

Community discussion with the milliseconds solution: Dynamic Date Comparison in Find Records Automation

Airtable: Dynamic Date Comparison in Find Records Automation