Home » excel » How can Excel do conditional formatting based on a comparison with the above cell?

How can Excel do conditional formatting based on a comparison with the above cell?

Posted by: admin May 14, 2020 Leave a comment

Questions:

I have a table which is supposed to have a sequential id number at the beginning as in 1,2,3,4,5,6….

HOWEVER, during the export of the data, there appears to have been a bug which pastes two rows on just one row thus breaking the sequence. I am trying to identify these rows by conditonal format and am currently using this formula which is not working:

 ="IF($A2+1==$A3,TRUE,FALSE)"
 # Note the +1 is to account for the header row

I have tried moving the “$” around, but still no cigar.

My other option is to compare the sequence to the row number as in:

 ="IF($A2+1=ROWS($A1), TRUE, FALSE)

but that hasen’t worked either.

I’m guessing it has to do with

I am trying to conditionally format the column so that I can identify where I need to insert a row and make a copy paste.

Right now, I am trying to use conditional formatting but am failing in this regard. I don’t know how to use VBA so as of now, I would prefer to use the menu before getting into VBA.

How to&Answers:

Instead of using an IF formula in the conditional formatting, try this:

=A2+1<>A3

Somewhat crude, but should do what you want (i.e. highlight the cells that break the sequence).

enter image description here

Answer:

If you remove your == and your ", your formulas should work, but as Rocket Donkey put it, your condition will return TRUE or FALSE anyway, so you can remove the IF structure altogether.