Conditional formatting on visible range?

1.3k views Asked by At

I have a table with times of actions and I want to highlight rows that are more than 20-ish minutes more than the one above.
The actual number of minutes is less important.

For that I use conditional formatting with the formula:
=F3-F2>0,01766

enter image description here

So far so good.
But now if I apply filter on the table the the formula does not work anymore because it looks at the hidden rows.
Only the first highlight is made by the conditional formatting the other two are done by me.

enter image description here

Is it possible to get conditional formatting to look at the visible rows only?

2

There are 2 answers

1
nightcrawler23 On BEST ANSWER

I was able to come up with a solution only by using a special columns for the filtered index. In my example, i am filtering the data by '1', So i will add '1' in Column L. If you have multiple filters, you can add in the next rows in col L.

Col H checks if cell in Col E exists in the filters list

Col I finds the last row that is not filtered. The formula has to be entered as an Array Formula i.e. enter the formula and press Ctrl Shift Enter

Col J checks if the difference between cells in Col F for the current row and the last not filtered row is between 20 and 21 minutes. Conditional formatting is applied for this cell being true

Below image without applying any filter No Filter

After adding '1' as filter filter 1

Filtered rows hidden filter hidden

Formula Formula

Here is a Google Sheet

0
Tim Williams On

Note that SUBTOTAL() has options for ignoring hidden rows: this gives you a way to create a formula-based helper column for determining whether or not a row is filtered out....

enter image description here

Note Col C is an Array formula

After filtering for "A" only:

enter image description here

This way you can filter on multiple columns if required.