Monday, August 3, 2015

microsoft excel - How to highlist cell A1 if ANY cell in column B is highlighted


I'm hoping there's an easy answer using conditional formatting, but if not I'm fine with entering in some VBA.


Column A (starting at row 2) has a calculated position (an integer) based on certain criteria.
Column B (starting at row 2) has a hard-coded position (an integer).


I have conditional formatting on Column B that will highlight the cell red (the "Bad" style format) if the value in B is less than the value in A. This works great. But I have many of these files and many rows in each file, so I don't want to have to scroll down each file to find a red highlighted cell. What I'd like instead is to highlight cell A1 if ANY of the cells in Column B are highlighted, i.e. are less than their respective A cell.


Is this possible with a conditional format in cell A1? I've tried COUNTIFS() but wasn't able to figure it out, don't know if that's the correct function I'm looking for.


Answer



If any cell in column B is less than the equivalent cell in column A then:


=MAX(A2:A9999-B2:B9999)>0

will be True


So you can use the formula in the conditional formatting.


EDIT#1:


Enter as an array formula.


Array formulas must be entered with Ctrl + Shift + Enter rather than just the Enter key. If this is done correctly, the formula will appear with curly braces around it in the Formula Bar.


No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...