How to Highlight Cells Containing Specific Function In Google Sheets

Published on

Our Google Sheets file may contain several formulas spread across one Sheet. It’s easy to highlight all of them in one go.

But what about highlighting cells that contain a specific function in Google Sheets?

For example, you want to highlight all the cells containing the Vlookup function with one color, Sumif function with some other color, and so on.

In this tutorial, let’s learn how to highlight specific functions in Google Docs Sheets.

As a side note, we can use the ISFORMULA function to highlight all the cells containing formulas in one go.

Highlighting Cells Containing a Specific Function in Google Sheets

We can use operators for building formulas in Google Sheets. So let’s begin with highlighting some of them.

Related:- How to Sum, Multiply, Subtract, Divide Numbers in Google Sheets.

Conditional Format Addition Operator

An addition formula in Google Sheets is made up of an = (equal) sign followed by two or more numbers separated by the + (plus) sign.

Here is one example of a Google Sheets addition formula.

=5+15+30

or

=A1+B1+C1

How to highlight cells containing such specific formulas in Google Sheets?

Here, in the below example, I have additional formulas in the range D3:D5 and I3:I5.

The formula in cell D3, i.e., =A3+B3+C3, has been copied to the cells D4 and D5.

Similarly, the formula in cell I3, i.e., =F3+G3+H3, has been copied to the cells I4 and I5.

Highlight Cells Containing Operator Based Formulas in Google Sheets

I have used the below custom rule to highlight the formulas in the said range in Google Sheets.

=regexmatch(FORMULATEXT(A1),"\+")

To apply this rule, first, select the range A1:I5.

Then enter the Regex formula in Format > Conditional formatting > Format Rule > Custom formula.

The above is an example of highlighting cells containing a specific function, here addition, in Google Sheets.

Understand the Custom Rule

Syntax:- REGEXMATCH(text, regular_expression)

Text – The FORMULATEXT function can return a formula from any cell as a text.

The Formulatext in the above rule checks all cells in A1:I5 (the selected range for conditional formatting) for a formula string.

Regular_Expression – To highlight cells containing a specific function, we must specify that function or operator in the regular_expression part of the formula. In our case, it is the + operator.

Note:- Some cells may contain text strings, i.e., Mango+Orange, which are not formulas. Such cells won’t get highlighted because the FORMULATEXT function would return N/A in that case.

Conditional Format Subtraction Operator

All the above points are applicable here. Only change the operator in the formula rule.

=regexmatch(FORMULATEXT(A1),"\-")

Conditional Format Division Operator

This custom rule is also in line with the above rules.

=regexmatch(FORMULATEXT(A1),"\/")

Here comes a question. What about multiple operators in a formula?

=A3+B3-C3

Please see this rule.

=regexmatch(FORMULATEXT(A1),"\-|\+")

Highlight SUMIF Function Cells in Google Sheets

To highlight cells containing a specific function, for example, SUMIF in Google Sheets, you can use the above custom rule with some modifications.

Here is the conditional format rule to highlight cells that contain the Sumif function in Google Sheets.

To apply, first, select the range and use this custom rule in conditional formatting.

=regexmatch(FORMULATEXT(A1),"(?i)sumif")

This formula highlights the cells G2 and G3 in my example.

Highlight Cells Containing Sumif Function in Google Sheets

Also, this is a case-insensitive Regex formula.

So even if you type the Sumif function in caps, lower, or proper case letters, it (the custom rule) can highlight those cells.

Highlight Cells that Contain Any Chosen Function in Google Sheets

To conditional format, the cells containing the VLOOKUP function, use this rule.

=regexmatch(FORMULATEXT(A1),"(?i)vlookup")

Similarly, you can replace the string in the expression, which is vlookup here, with any other function name.

You May Like:-

Prashanth KV
Prashanth KV
Your Trusted Google Sheets and Excel Guide Prashanth KV brings a wealth of experience in Google Sheets and Excel, cultivated through years of work with multinational corporations in Mumbai and Dubai. As a recognized Google Product Expert in Docs Editors, Prashanth shares his expertise through insightful blogging since 2012. Explore his blog for practical tips and guidance on maximizing your spreadsheet skills.

Lookup Values Under Categories in Excel and Google Sheets

We can use a combination of XLOOKUP and VLOOKUP in both Excel and Google...

Extract Items Under a Category from the Same Column in Excel

In Excel, you can use a combination of the XLOOKUP and DROP functions to...

How to Create a Searchable Table in Excel Using the FILTER Function

Finding specific records, or rows containing the required information, is straightforward in Excel using...

Time Sequences in Excel by Minute, Hour, or Second Increments

Creating time sequences, whether by hour, minute, or second increments in Excel, can be...

More like this

XMATCH Row by Row: Finding Values Across a Range in Google Sheets

Using the BYROW function with XMATCH in Google Sheets allows us to match values...

Limit Formula Expansion to a Specific Row in Google Sheets

In this tutorial, I’ll explain how to limit the expansion of an array formula...

3-D Referencing Structured Data Tables in Google Sheets

When you have several tables within a single sheet—not across multiple sheets in a...

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.