Pinterest Pixel

How to Use Contains in Excel – Cell Formula Check Tips

John Michaloudis
As someone who spends a lot of time working with Excel, I often need to determine whether a cell contains a formula.
This is particularly useful when auditing spreadsheets, troubleshooting errors, or ensuring that my calculations are set up correctly.

In this guide, I’ll walk you through different methods to check if a cell contains formula in Excel.

As someone who spends a lot of time working with Excel, I often need to determine whether a cell contains a formula. This is particularly useful when auditing spreadsheets, troubleshooting errors, or ensuring that my calculations are set up correctly. In this guide, I’ll walk you through different methods to check if a cell contains formula in Excel.

Key Takeaways:

  • Formulas in Excel dynamically update calculations, whereas values remain static.
  • The ISFORMULA function helps identify formula-containing cells quickly.
  • Conditional formatting can highlight all cells with formulas for easy visualization.
  • Go To Special allows bulk selection of formula-based cells for auditing.
  • VBA can automate formula identification, improving efficiency in large datasets.

 

Introduction

Understanding Formulas in Excel

Formulas are essential for performing calculations and automating data analysis in Excel. They use mathematical expressions, cell references, and built-in functions to compute results dynamically. When a formula is entered into a cell, Excel recalculates the output whenever referenced data changes.

Difference Between Formulas and Values

Understanding the difference between formulas and values is crucial. A value is a static number or text entered directly into a cell, whereas a formula dynamically calculates a result based on references and operations. Identifying formula-based cells ensures accuracy and prevents accidental overwrites.

 

Common Scenarios Requiring Formula Checks

There are several situations where checking for formulas is necessary:

  • Financial Models – Ensuring that calculations are intact and not replaced with static numbers.
  • Reports & Dashboards – Verifying that key metrics update correctly when data changes.
  • Data Entry & Validation – Ensuring user inputs do not override critical formula-driven calculations.

 

Different Methods to Check Cell Contains Formula

Using the ISFORMULA Function

One of the easiest ways to check if a cell contains a formula is by using the ISFORMULA function. This built-in function returns TRUE if the specified cell contains a formula and FALSE otherwise.

STEP 1: Select an empty cell where you want to display the result.

Contains in Excel

STEP 2: Enter the following formula:

=ISFORMULA(D2)

Contains in Excel

STEP 3: Press Enter to see the result.

Contains in Excel

If the cell contains a formula, the result will be TRUE; otherwise, it will be FALSE.

Using Conditional Formatting to Highlight Cells with Formulas

If you want to visually identify all the cells that contain formulas, conditional formatting is a great option.

STEP 1: Select the range of cells you want to check.

Contains in Excel

STEP 2: Go to the Home tab and click on Conditional Formatting. Choose New Rule.

Contains in Excel

STEP 3: Select Use a formula to determine which cells to format.

Contains in Excel

STEP 4: Enter the following formula:

=ISFORMULA(B2)

Contains in Excel

STEP 5: Click on Format, choose a highlight color, and click OK.

Contains in Excel

STEP 6: Click OK again to apply the formatting.

Now, any cell that contains a formula will be highlighted automatically.

Contains in Excel

Using Go To Special to Select Formula Cells

Another quick way to find all the formula-containing cells in a worksheet is by using the Go To Special feature.

STEP 1: Press Ctrl + G or go to the Home tab and click Find & Select > Go To Special.

Contains in Excel

STEP 2: Select Formulas and click OK.

Contains in Excel

Excel will select all the cells that contain formulas.

Contains in Excel

This method is especially useful when you need to quickly identify all formulas in a spreadsheet.

 

Advanced Techniques

Using VBA to Identify Cells with Formulas

If you work with large datasets and frequently need to check for formulas, using VBA (Visual Basic for Applications) can automate the process.

STEP 1: Press Alt + F11 to open the VBA editor.

Contains in Excel

STEP 2: Click Insert > Module.

Contains in Excel

STEP 3: Copy and paste the following VBA code:

Sub HighlightFormulaCells()
Dim ws As Worksheet
Dim cell As Range
Set ws = ActiveSheet
For Each cell In ws.UsedRange
If cell.HasFormula Then
cell.Interior.Color = RGB(255, 255, 0) ' Highlights in yellow
End If
Next cell
End Sub

Contains in Excel

STEP 4: Press F5 to run the macro.

Contains in Excel

This macro highlights all the cells that contain formulas, making them easy to spot.

 

Real-world Examples to Guide You

Knowing whether a cell contains a formula can be beneficial in various scenarios, such as:

  • Data Auditing: Ensuring calculations are applied correctly in financial or analytical reports.
  • Troubleshooting Errors: Identifying misplaced or incorrect formulas that might be causing calculation issues.
  • Spreadsheet Optimization: Removing unnecessary formulas to improve performance and efficiency.
  • Protecting Data Integrity: Preventing accidental overwriting of important calculations.

 

FAQs

1. How can I quickly check if a cell contains a formula in Excel?

You can use the ISFORMULA function to check if a cell contains a formula. Simply enter =ISFORMULA(A1) in an empty cell, replacing A1 with the cell reference you want to check. If the result is TRUE, the cell contains a formula; if it’s FALSE, it holds a static value.

2. Is there a way to highlight all cells with formulas automatically?

Yes, you can use Conditional Formatting to highlight formula-containing cells. Go to Home > Conditional Formatting > New Rule, select Use a formula to determine which cells to format, and enter =ISFORMULA(A1). Choose a highlight color and click OK. This will automatically highlight any cell containing a formula.

3. How can I select all formula-containing cells at once?

You can use the Go To Special feature to select all formula cells in a worksheet. Press Ctrl + G, click Special, choose Formulas, and click OK. Excel will instantly highlight all formula-based cells, making it easier to review or modify them.

4. Can I automate formula identification in large datasets?

Yes, you can use a VBA macro to highlight all formula-containing cells. Open the VBA editor (Alt + F11), insert a new module, and paste the following code:

Sub HighlightFormulaCells()
Dim cell As Range
For Each cell In ActiveSheet.UsedRange
If cell.HasFormula Then cell.Interior.Color = RGB(255, 255, 0)
Next cell
End Sub

Run the macro, and all formula cells will be highlighted in yellow.

5. Why is it important to check for formulas in Excel?

Checking for formulas ensures accuracy in calculations, prevents accidental overwrites, and helps troubleshoot errors in complex spreadsheets. It is especially useful in financial models, reports, and data validation, ensuring that formulas update dynamically rather than being replaced by static values.

If you like this Excel tip, please share it


Founder & Chief Inspirational Officer

at

John Michaloudis is a former accountant and finance analyst at General Electric, a Microsoft MVP since 2020, an Amazon #1 bestselling author of 4 Microsoft Excel books and teacher of Microsoft Excel & Office over at his flagship MyExcelOnline Academy Online Course.

See also  MAX Formula in Excel

Star 30 Days - Full Access Star

One Dollar Trial

$1 Trial for 30 days!

Access for $1

Cancel Anytime

One Dollar Trial
  • Get FULL ACCESS to all our Excel & Office courses, bonuses, and support for just USD $1 today! Enjoy 30 days of learning and expert help.
  • You can CANCEL ANYTIME — no strings attached! Even if it’s on day 29, you won’t be charged again.
  • You'll get to keep all our downloadable Excel E-Books, Workbooks, Templates, and Cheat Sheets - yours to enjoy FOREVER!
  • Practice Workbooks
  • Certificates of Completion
  • 5 Amazing Bonuses
Satisfaction Guaranteed
Accepted paymend methods
Secure checkout

Get Video Training

Advance your Microsoft Excel & Office Skills with the MyExcelOnline Academy!

Dramatically Reduce Repetition, Stress, and Overtime!
Exponentially Increase Your Chances of a Promotion, Pay Raise or New Job!

Learn in as little as 5 minutes a day or on your schedule.

Learn More!

Share to...