Spreadsheet Practice

How to filter rows from the last 30 days in Excel

Excel formula

=FILTER(A2:C9,(A2:A9>=F1-F2)*(A2:A9<=F1),"No rows")

Keep the rows dated from today minus 30 to today: =FILTER(A2:C9,(A2:A9>=F1-F2)*(A2:A9<=F1),"No rows").

Result on the example
a 5-row list that spills from E4 in E4
Works in
Excel 2021, 2024 and Microsoft 365
Google Sheets
Different formula, see below

See it work

The formula is already in E4. Change any input and the result updates, or edit the formula to experiment.

How it works

F1-F2 is the date 30 days before today. Multiplying the two tests keeps the rows on or after that date and on or before today, and FILTER returns the whole matching rows. The October 30 row is in the future, so it is left out. Change F2 to 7 or 90 for other windows.

=FILTER(A2:C9,(A2:A9>=F1-F2)*(A2:A9<=F1),"No rows")

Result{5 rows × 3 cols} 46294, "Brightline", 1280, 46298, …

  1. A2:C98 rows × 3 cols: 9/15/2026, "Acme", $420, 9/29/2026, …

    A range: 8 rows × 3 columns.

  2. A2:A98 rows × 1 col: 9/15/2026, 9/29/2026, 10/3/2026, 10/14/2026, …

    A range: 8 cells in one column.

  3. F110/29/2026

    The value in F1.

  4. F230

    The value in F2.

  5. F1-F246294

    The - operator subtracts.

  6. A2:A9>=F1-F2{8 rows × 1 col} FALSE, TRUE, TRUE, TRUE, …

    The >= operator tests at least.

  7. A2:A9<=F1{8 rows × 1 col} TRUE, TRUE, TRUE, TRUE, …

    The <= operator tests at most.

  8. A2:A9>=F1-F2)*(A2:A9<=F1{8 rows × 1 col} 0, 1, 1, 1, …

    The * operator multiplies.

  9. FILTER(A2:C9,(A2:A9>=F1-F2)*(A2:A9<=F1),"No rows"){5 rows × 3 cols} 46294, "Brightline", 1280, 46298, …

    FILTER: Rows of a range that meet every condition. #N/A when none match.

    • rangeA2:C98 rows × 3 cols: 9/15/2026, "Acme", $420, 9/29/2026, …
    • condition1A2:A9>=F1-F2)*(A2:A9<=F1{8 rows × 1 col} 0, 1, 1, 1, …
    • condition2, ..."No rows"

In Google Sheets

Google Sheets needs a different formula: =FILTER(A2:C9,A2:A9>=F1-F2,A2:A9<=F1). On the same data it gives the same result. Here it is running in Google Sheets mode.

Other ways to do it

Each one was run on the same example sheet.

FormulaResultWhen to use it
=FILTER(A2:C9,A2:A9>=F1-F2,"No rows")spills 6 × 3Different resultWithout the upper limit, future-dated rows are included. Includes the October 30 row.

Common mistakes

  • "Last 30 days" can mean 30 or 31 calendar days depending on whether today counts. Here today and the 30 days before it are included; use >F1-F2 for exactly 30.
  • Google Sheets FILTER takes each condition as its own argument and has no "if empty" value; wrap it in IFERROR for that.

Try it yourself

Same data, empty answer cell. Your formula is graded instantly, then re-checked on changed data, so a typed-in number won't pass.

Filter rows from the last 30 days

In E4, return the rows dated from the number of days in F2 before the date in F1 up to and including F1.

Questions

How do I total the last 30 days instead?

=SUMIFS(C2:C9,A2:A9,">="&F1-F2,A2:A9,"<="&F1).

How do I filter the last full calendar month?

Use the month bounds: (A2:A9>=EOMONTH(F1,-2)+1)*(A2:A9<=EOMONTH(F1,-1)).

Checked by running on 2026-10-30: every formula and result on this page was calculated by the Spreadsheet Practice formula engine, in both Excel and Google Sheets modes.