HomeGoogle DocsSpreadsheetHow to Highlight Cells Containing Specific Function In Google Sheets

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.

Creating Sequential Dates in Equally Merged Cells in Google Sheets

Do you know how to create sequential dates in equally merged cells across a...

Running Total By Month in Excel

This tutorial demonstrates how to calculate the running total by month in a range...

SORT and SORTBY – Excel Vs Google Sheets

While Excel offers the SORT and SORTBY functions for sorting a table, Google Sheets...

Get Top N Values Using Excel’s FILTER Function

When using the FILTER function in Excel to extract the top N values, it's...

More like this

Creating Sequential Dates in Equally Merged Cells in Google Sheets

Do you know how to create sequential dates in equally merged cells across a...

Interactive Random Task Assigner in Google Sheets

You have multiple tasks and multiple people. Here's a fun way to randomly assign...

Google Sheets Bar and Column Chart with Target Coloring

To color each data point in the column or bar chart according to the...

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.