How to Filter Cells with Formulas in Excel – 2 Methods

This is an overview.

filter cells with formulas in excel overview


Method 1 – Using the FILTER and the ISFORMULA Functions to Extract Cells Containing Formulas

In the datset below, Column D contains the output, some of which were obtained by using formulas (displayed beside).

To find the presence of formulas in Column D:

using filter and isformula functions to filter cells with formulas in excel

  • Create a header row at the bottom of the table (13) with the headers.
  • In B14, enter the following formula:
=FILTER(B5:D11,--ISFORMULA(D5:D11)=1,"Not Found")
  • Press Enter and an array with the filtered data will be displayed.

using filter and isformula functions to filter cells with formulas in excel

Formula Breakdown

The ISFORMULA function searches for all formulas used in Column D and returns TRUE if it finds any formula. Otherwise, FALSE.

The use of Double-Unary(--) before the ISFORMULA function converts TRUE and FALSE to numeric values- 1 and 0.

--ISFORMULA(D5:D11)=1” defines the criteria for filtering tables.

In the third argument of the FILTER function, an output message is set if no data meets the given condition.


Method 2 – Using the VBA Editor to Filter Cells Containing Formulas in Excel

using vba to filter cells with formulas in excel

Step 1: Preparing Macros to Filter Cells with Formulas in Excel

  • To create and customize a user-defined formula, press ALT+F11 to open the VBA window.
  • In Insert, select Module.
  • Enter the code in the module window:
Option Explicit

Function HasFormula(Cell)

HasFormula = Cell.HasFormula

End Function

using vba to filter cells with formulas in excel

  • Press F5 and name the macro in the Macros dialog box. Here, ContainFormulas.
  • Click Create.

using vba to filter cells with formulas in excel


Step 2: Use a Customized Function to Filter Cells with Formulas

  • Go back to your Excel spreadsheet and in E5, enter:
=HasFormula(D5)
  • Press Enter and use the Fill Handle to autofill Column E.

The formula will return boolean values- TRUE and FALSE.

using vba to filter cells with formulas in excel


Step 3: Filtering Cells That Contain No Formulas

  • Place the cursor on Contains Formula?.
  • Right-click.
  • Select Filter by Selected Cell’s Value in Filter.

using vba to filter cells with formulas in excel

  • After assigning the Filter buttons to the headers, open the Filter option in Contains Formula?.
  • In the Search box, check TRUE.
  • Click OK.

using vba to filter cells with formulas in excel

This is the output.

using vba to filter cells with formulas in excel


Download Practice Workbook

Download the Excel workbook.


<< Go Back to Data | Filter in Excel | Learn Excel

Get FREE Advanced Excel Exercises with Solutions!
Nehad Ulfat
Nehad Ulfat

NEHAD ULFAT is an excellent marine engineer who loves working with Excel and diving into VBA programming. For him, programming is like a tool that saves time when dealing with data, files, and the internet. His skills go beyond the basics, including ABACUS, AutoCAD, Rhinoceros, Maxsurf, and Hydromax. He got his B.Sc in Naval Architecture & Marine Engineering from BUET but switched gears, working as a content developer.  In this role, he creates techy content all about Excel... Read Full Bio

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo