Highlight Row Above Hidden Row in Google Sheets

Published on

In Google Sheets, you might hide rows to declutter large datasets—whether in financial reports, project trackers, or inventory logs. But what if you want to visually highlight the row just above a hidden one?

This can be especially helpful when you want to indicate that something has been hidden below—like completed tasks, irrelevant details, or outliers. Think of a project manager who hides completed rows but wants to flag the last visible task before that collapsed group. In such cases, highlighting the row above each hidden row provides a clear visual cue.

In this tutorial, you’ll learn how to detect hidden rows using a formula and then highlight the row above each one using conditional formatting. It works regardless of how the rows are hidden—manually, by filters, slicers, or groups.

Why Highlight the Row Above a Hidden Row?

There are several practical use cases:

  • Project management: Mark the active task just before a batch of hidden (completed) ones.
  • Finance dashboards: Signal the end of a month or quarter that’s been collapsed.
  • Inventory sheets: Visually separate available stock from archived items.

Whatever the use case, this technique improves clarity without revealing the hidden data.

Important Note Before You Begin

The method described here doesn’t work if there are empty cells in the range where you apply the conditional formatting rule. Make sure the target column (the one used to detect hidden rows) does not contain blank cells within the range where you’re applying the rule.

Step 1: Detect Hidden Rows in Google Sheets (Using Formula)

Google Sheets provides a powerful function to detect visible rows: the SUBTOTAL function.

Enter the following formula to check whether a row is hidden:

=SUBTOTAL(103, A2) = 0

How It Works:

  • SUBTOTAL(103, A2) returns 1 if the cell in row 2 (column A) is visible.
  • It returns 0 if row 2 is hidden.
  • So =SUBTOTAL(103, $A2)=0 returns TRUE when row 2 is hidden.

Adjust the formula reference based on your actual range.

For example, if your conditional formatting starts from row 10 in column C, use C11 in the formula instead of A2.

Example:

If rows 5, 9, 10, and 15 are hidden, the formula in row 4 (i.e., referencing A5) will return TRUE, and we can use that to highlight row 4.

Manually Hidden Rows in Google Sheets with Row Numbers Skipped

Step 2: Highlight Row Above Hidden Row in Google Sheets

Now that we can detect a hidden row, let’s apply a conditional formatting rule to highlight the row just above it.

Instructions:

  1. Select the range where you want to apply the rule — for example, A1:A100.
  2. Go to Format > Conditional Formatting.
  3. Under Format rules, select “Custom formula is”.
  4. Enter this formula:
    =SUBTOTAL(103, $A2)=0
  5. Pick a highlighting color of your choice.
  6. Click Done.

This formula works because when you’re formatting row 1, it checks whether row 2 is hidden. If it is, row 1 gets highlighted.

Result:

If rows 5, 9, 10, and 15 are hidden, the rule will highlight rows 4, 8, and 14 (the rows immediately above each hidden one).

Highlighted Rows Directly Above Hidden Rows in Google Sheets Using Conditional Formatting

How to Identify Hidden Rows Manually

While the formula handles detection programmatically, here’s how to spot hidden rows manually:

  • Manually hidden rows: You’ll see a small arrow between row numbers.
  • Grouped rows: Look for minus (-) or plus (+) signs in the row header. These indicate expandable/collapsible groups.
  • Filtered rows: If a filter is applied, hidden rows won’t be numbered consecutively.

These visual indicators can help verify that your formatting rule is working as intended.

Conclusion

This formula-based technique for highlighting the row above each hidden row in Google Sheets is simple yet powerful. Whether you’re using hidden rows for presentation or data cleanup, this formatting trick can improve readability, usability, and workflow visibility.

Just remember:

  • The rule doesn’t work with empty hidden cells.
  • Always reference the row below in your formula.

You May Also Like:

Prashanth KV
Prashanth KV
Your Trusted Google Sheets and Excel Expert Prashanth KV is a Diamond Product Expert in Google Sheets, officially recognized by Google for his contributions to the Docs Editors Help Community and featured in the Google Product Experts Directory. Explore his blog to learn advanced formulas, automation tips, and problem-solving techniques to elevate your spreadsheet skills.

Top Discussions

More like this

Pivot Table Formatting, Output & Special Behavior in Google Sheets

Pivot Tables in Google Sheets are powerful—but they can get tricky once you move...

Pivot Table Calculations & Advanced Metrics in Google Sheets

When it comes to built-in tools for data analysis and visualization in Google Sheets,...

Google Sheets Pivot Table Tutorial: Basics, Setup, and Date Grouping

The easiest way to summarize, analyze, and report data in Google Sheets is by...

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.