Finding Formulas Containing a Specific Function

Written by Allen Wyatt (last updated September 5, 2026)

2

Hilary has formulas scattered throughout a workbook that contain a particular function. She wants to replace that function with a different approach, but the first step is to locate the formulas she needs to change. Hilary wonders how she can locate every formula containing a specific function without also finding cells that merely contain the function's name as text.

If you only need to find specific functions once in a while, then you can use Find and Replace to do the searching. Let's say, for instance, that you want to find formulas that contain the GAMMA function. You can follow these steps:

  1. Press Ctrl+F. Excel displays the Find tab of the Find and Replace dialog box.
  2. Click the Options button, if necessary, to enlarge the dialog box. (See Figure 1.)
  3. Figure 1. The Find tab of the Find and Replace dialog box.

  4. In the Find What box, enter this: GAMMA(
  5. Make sure the Look In drop-down list is set to Formulas.
  6. Click Find Next.

At this point, Excel selects the first cell that includes the GAMMA function. It is important to use the opening parenthesis in step 4, as this will help ensure that text-only mentions of GAMMA are skipped.

If you need to repeat the same process regularly, then your best bet may be to create a macro to assist. All you need to do is have the macro ask for the function to be located, and then it can do the rest. Here's an example:

Sub FindTextInFormulas()
    Dim c As Range
    Dim searchText As String
    Dim searchRange As Range
    Dim numFound As Long
    Dim sMsg As String

    searchText = InputBox("Enter the function name to find in formulas:")
    If Len(searchText) > 0 Then
        searchText = Ucase(searchText) & "("

        On Error Resume Next
        Set searchRange = Selection.SpecialCells(xlCellTypeFormulas)
        On Error GoTo 0

        If searchRange Is Nothing Then
            sMsg = "No formulas found in the selected range"
        Else
            numFound = 0
            For Each c In searchRange
                If InStr(1, c.Formula, searchText, vbBinaryCompare) > 0 Then
                    c.Interior.Color = vbYellow
                    numFound = numFound + 1
                End If
            Next c
            sMsg = "No matches found"
            If numFound > 0 Then
                sMsg = "Found " & numFound & " cells with that function"
            End If
        End If

        MsgBox sMsg, vbInformation
    End If
End Sub

To use the macro, select the cells you want to check and then run it. The only thing the macro changes is the color fill of any cells that contain the text you want. Notice that the macro also converts the user-entered text to uppercase and appends an opening parenthesis to the string. When combined with setting the fourth parameter of the InStr function to vbBinaryCompare, this helps ensure that there are very few "false positives" in what the macro does.

Note:

If you would like to know how to use the macros described on this page (or on any other page on the ExcelTips sites), I've prepared a special page that includes helpful information. Click here to open that special page in a new browser tab.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (14001) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, 2021, 2024, and Excel in Microsoft 365.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Selecting a Specific Cell in a Macro

Need to use a macro to select a specific cell in a different workbook? It's not as straightforward of a proposition as ...

Discover More

Can't Use Hyperlinks

Before some features in Excel can function properly, you must have the correct permissions set for the user of the ...

Discover More

Applying the Correct Table Style to All Tables in a Document

If you need to apply table styles to a lot of tables in a document, then this tip may be helpful. It shows how to use a ...

Discover More

Create Custom Apps with VBA! Discover how to extend the capabilities of Office 365 applications with VBA programming. Written in clear terms and understandable language, the book includes systematic tutorials and contains both intermediate and advanced content for experienced VB developers. Designed to be comprehensive, the book addresses not just one Office application, but the entire Office suite. Check out Mastering VBA for Microsoft Office 365 today!

More ExcelTips (ribbon)

Finding Boolean Values

Excel worksheets can contain all sorts of data. One thing you might store in a worksheet is a range of Boolean (TRUE or ...

Discover More

Searching for Line Breaks

If you need to find where line breaks are located in cells, there are a couple of ways you can proceed. Here's a quick ...

Discover More

Find and Replace in Headers

Using Find and Replace is something quite routine in Excel, as it easily allows you to find and replace information in ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is 4 + 4?

2026-09-13 14:10:18

J. Woolley

My Excel Toolbox includes the following dynamic array function to return all non-blank formulas from a Target range of cells on any worksheet:
=ListFormulas(Target, [WithValues], [SkipConstants], [SkipHeader])
Expect 2 columns (Cell, Formula) or 3 columns (Cell, Formula, Value) and N rows (plus header). When SkipConstants is TRUE only formulas that begin with = are returned.
If this function is in cell B1 (for example), the following formula in cell A2 will create a hyperlink to the formula located at the Cell value identified in B2:
=HYPERLINK("[?]"&B2)
That formula can be dragged down column A for a hyperlink to each item in the list created by ListFormulas.
See https://sites.google.com/view/MyExcelToolbox/


2026-09-05 05:19:17

Alex Blakenburg

In the manual Find & Replacement method a couple of useful options are:
• If you click on the Find All button it will pop up a list of all the cells found. If you then click on one of the items in the list and hit Ctrl+A it will select them all in the worksheet.
• In Find Next. You can close the Find dialogue box and by hitting F4 it will perform a Find Next and cycle through all the identified cells.


This Site

Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.