Apply Conditional Formatting Around Dynamic FILTER Results in Excel
Question details
The user needs to automatically apply a border to a changing spill range generated by a FILTER formula in Excel for the web, avoiding manual formatting and macros.
- Product
- Excel for the web
- Device & OS
- not provided
- Scenario
- Formatting dynamic array outputs to automatically add borders around visible data.
- Observed behavior
- The FILTER formula creates a dynamically resizing spill range, making static borders impractical as they do not adapt to the changing data size.
Verify that your FILTER formula is correctly outputting the expected results and identify the maximum possible range your dynamic array might occupy.
Use a Non-Blank Conditional Formatting Rule
Apply a conditional formatting rule based on a formula over a predefined maximum range to dynamically format cells only when they contain data.
Because Excel for the web can have limitations when applying format rules directly to dynamic spill ranges using the spill operator (#), the most reliable method is to format a static, larger range using a formula that checks for empty cells.
Click and drag to highlight the maximum range where you expect the FILTER spill results to appear (for example, A2:E1000).
Navigate to the Home tab on the ribbon, click on Conditional Formatting, and select New Rule.
Choose the option 'Use a formula to determine which cells to format' and enter a rule that tests if the top-left cell of your selection is not empty, such as =A2<>"".
Click the Format button, go to the Border tab, select the Outline preset to add a border, and click OK to apply the rule.
Automatically Format Dynamic Arrays with WPS Spreadsheet
WPS Spreadsheet provides seamless support for dynamic array formulas like FILTER, along with robust conditional formatting tools. You can effortlessly style dynamic data without encountering the limitations often found in web-based spreadsheet applications.
- 1. Open your workbook: Launch WPS Spreadsheet and open the file containing your data.
- 2. Enter the formula: Type your =FILTER() formula into the desired starting cell to generate the dynamic array.
- 3. Select the maximum range: Highlight the largest area your dynamic array might expand into.
- 4. Apply conditional format: Go to Home > Conditional Formatting > New Rule, and use the formula =A2<>"" to check for non-blank cells.
- 5. Set the border style: Click Format, configure your desired border style, and click OK to instantly apply borders to all dynamic results.

Frequently Asked Questions
Can I use the spill operator (#) in conditional formatting?
In some desktop versions of Excel, you can use the spill operator (e.g., =A2#) to reference the array. However, Excel for the web often struggles with applying conditional formats directly to the spill operator. Setting a rule across a larger static range checking for non-blank cells is a safer, universally supported method.
Why do the borders remain when the FILTER array shrinks?
If borders remain on empty cells, it means static formatting was applied instead of conditional formatting. Ensure you remove all static borders from the range and exclusively use Conditional Formatting with a rule like =A2<>"".
Does this method require enabling macros?
No. Using conditional formatting entirely eliminates the need for VBA or macros, ensuring your workbook remains a safe, standard .xlsx file.




