Thanks for your reply. It's a good idea, I hadn't thought of testing for blank rows rather than numbered rows! I'll try it out. I'm concerned about cases where there may be more than one blank row together in the middle of a unit, but if I run into problems I'll come back and update.
UPDATE:
Your idea worked! The top borders work well. However, I'd like to be able to address cases where there is an interruption of more than one row in a unit, so I'd still like to know the answer to my original question.
How can I find the previous cell in a column with a number value, and check it against the next cell in the column with a number value? Do you have any ideas?
Thanks again for your help!
UPDATE:
I cracked it!
Here is the solution I found to the above problem in bold:
- IF(ISNUMBER(B:B),ROW(B:B)) returns an array of row numbers of those cells in column B that contain numbers.
- Wrapping that in a MIN or a MAX returns the lowest or highest row number in that array.
- Wrapping that in a MIN(1, ...) omits zeroes to avoid REF! errors.
- Wrapping that in INDIRECT("$D"&...) gives the value in the cell in column D in that row.
In order for this formula to work in a cell, because of the arrays, it needs to be wrapped in curly brackets {=FORMULA(...)}. As a Conditional Formatting rule, this isn't necessary.
In practice, I don't need to compare the two phrases directly. I just compare $D2 to each half for each CF rule, the top and bottom borders.
You can see my solution in the example attached.
If you have a better, more elegant solution, please share it!
Bookmarks