# Filter data between dates

=FILTER(data,(dates>=A1)*(dates<=A2),"No data")

To filter data to include records between two dates, you can use the FILTER function with boolean logic. In the example shown, the formula in F8 is:

=FILTER(B5:D15,(C5:C15>=F5)*(C5:C15<=G5),"No data")

Which returns records with dates between January 15 and March 15, inclusive.

This formula relies on the FILTER function to retrieve data based on a logical test created with a boolean logic expression. The array argument is provided as B5:D15, which contains the full set of data without headers. The **include** argument is based on two logical comparisons:

(C5:C15>=F5)*(C5:C15<=G5)

The expression on the left checks if dates are greater than or equal to the "From" date in F5. This is an example of boolean logic. The expression on the right checks if dates are less than or equal to the "To" date in G5. The two expressions are joined with a multiplication operator, which creates an AND relationship.

After logical expressions are evaluated, we have:

({TRUE;TRUE;TRUE;TRUE;TRUE;TRUE;TRUE;TRUE;TRUE;TRUE;TRUE})* ({TRUE;TRUE;TRUE;TRUE;FALSE;FALSE;FALSE;FALSE;FALSE;FALSE;FALSE})

Note there are eleven results in each set of parentheses, one for each date in the data. The multiplication operation coerces the TRUE FALSE values to 1s and 0s, so the final result is a single array like this:

{1;1;1;1;0;0;0;0;0;0;0}

Note the four 1s in the array correspond to the four dates that pass the test. This array is delivered to the FILTER function and used to filter the data. Only rows where the result is 1 make it into the final output.

The "if_empty" argument is set to "No data" in case no matching data is found.

## Excel Formula Training

Formulas are the key to getting things done in Excel. In this accelerated training, you'll learn how to use formulas to manipulate text, work with dates and times, lookup values with VLOOKUP and INDEX & MATCH, count and sum with criteria, dynamically rank values, and create dynamic ranges. You'll also learn how to troubleshoot, trace errors, and fix problems. Instant access. See details here.