Cell fill based on value of cell in row before

lee2121

New Member
Joined
Mar 14, 2017
Messages
41
Hello Everyone.

I have an excel file where i need the current cell to be filled with let's say a light red colour if the value entered into this cell is the same or less than the value in the cell above it.

For example

Cell A2 = 100 and Cell A1 = 110 then cell A2 should fill red and repeat for all other cells in the row.

I think a VBA solution may be best for this. I can do this in conditional formatting but i can't set up conditional formatting rules for each cell

The cells i need this to work on are Rows 2, 4, 6, 8 and 10

cell fill.png
 
Well maybe you should try Fluff's proposition then.
You probably misunderstood some of the instructions I gave you. I checked it again and no problem. Make sure you are referring to the correct cells in the formula.
Thank you for the reply this is how my formula looks after using the format painter.
 

Attachments

  • cell fill 5.png
    cell fill 5.png
    11.1 KB · Views: 4
Upvote 0

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
In R1C1 style the formula, i think, should be :
Excel Formula:
=R[-1]C>RC
In your formula you are referencing cells 2 columns to the left and 2/3 rows down. It's not what i indicated.
 
Upvote 1
Solution
In R1C1 style the formula, i think, should be :
Excel Formula:
=R[-1]C>RC
In your formula you are referencing cells 2 columns to the left and 2/3 rows down. It's not what i indicated.
Thank you this work perfectly, yes for some reason my excel file is using RC cell references and not the normal A, b etc. But your revised code to reflect my file worked brilliantly.
 
Upvote 0

Forum statistics

Threads
1,222,684
Messages
6,167,628
Members
452,124
Latest member
lozdemr

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top