Conditional formatting in Excel – Highlight if greater than left adjacent

You might come across a situation where you want to highlight a value if it is greater than its counter its left adjacent value. For example

Col A, Col B

In the above case you want to highlight 3 and 5 in column B. There is an easy excel formula for this. Note that in formula you will select single cells not range of cells!

Select col B from B1:B3, go to conditional formatting. This way the condition will be automatically applied to the selected cells. Go to the last option, custom “Use a formula to determine which cells to format”. In the textbox below, writet his formula

= B1 > A1

Do not forget the = sign! Now choose the format of any type you want by clicking the “Format” button. Hope this helped.

Be carefull not use $ sign since this hard codes the cell. For example

=$B$a>$A$1 will do wrong highlighting because it will apply the logic of Cell B1 > A1 and will apply across the selected range of cells. In other words it will not change to B2> A1, B3 > A3 and so on becaue $ sign hard codes the cells in the logic.

This entry was posted in Software Development and tagged , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s