SOLVED

Excel Conditional Formatting / Modification to "Stop If True"

Copper Contributor

Good morning.

 

TL;DR: I am trying to get a dynamic border that only applies to my very last row.

 

THE REST

I have an Excel spreadsheet of my active cases I'm working on. I have several different conditional formatting rules running, but one thing I would like to do is add a border that only activates for the last row. Essentially, a dynamic border that always underlines the lowest row.

 

I've tried a number of solutions that aren't working.

 

[1] I started out by trying =$A2<>"" (applied to $1:$1048576).

-- Column A is Case #, so this checks the row below my target row to see if I have entered a case number. If I have, then create a bottom border. This ended up doing the opposite of what I wanted: underlined every row except the bottom row.

 

[2] I tried =$A1<>"" (applied to $1:$1048576).

-- Checks to see if current row has a case number and applies a bottom border if so. This included my last row, but also included every other row.

 

[3] Switched to =ISBLANK(A2) (applied to $1:$1048576).

-- Checks to see if the row below my target row is blank. If it is, it applies the bottom border.

--- This almost works, but it looks awful because it applies a border to every empty row beyond that.

 

Which leads to my question: is there a way to modify a conditional formatting rule so that it stops after it has been true once? Stop If True typically stops running further conditional formatting rules, not the rule itself. I need to modify my rule so that once it finds a single empty row, it applies the border once and then stops running.

6 Replies
best response confirmed by majorthompson (Copper Contributor)
Solution
Try this:
=ROW()=COUNTA($A:$A)

Thank you both! Both formulas worked perfectly. Wish I could mark both as correct.

Of course, there are several ways to achieve the same result. Knowing the expertise of @Sergei Baklan, he will always find another way. It so happens that my formula is shorter, and thus inevitably faster, than his. The shorter and faster formula should be preferred at all times, so you don’t have to regret your choice. You made the right choice!

@Twifoo , I have no objections about the choice, just a comment on what faster formula is always has high priority. Maintainability and flexibility are often more important  than saving of few milliseconds in performance. As an example is shifting on such scenario

image.png

 

1 best response

Accepted Solutions
best response confirmed by majorthompson (Copper Contributor)