# CF to check if the cell is > or < than RELATIVE cell

#### drewberts

##### Board Regular
I have data for months and years as follows:-

2017 2018 2019 2020
Jan 150 175 160 200
Feb 160 170 180 220
Mar 210 185 160 200
Apr 195 200 200 250
...

I want to apply CF to show whether the same month is > or < than the same month in the previous year e.g. so if Jan 2017 is < Jan 2018 then the cell goes red, > it goes green. I'm trying to do it so it shows a comparision between a month and the same month in the previous year to that month. Hope than makes sense

### Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.

#### steve the fish

##### Well-known Member
You will have conflicting rules there. For example March 2018 would be both red and green. What takes precedent? Anyway you can change the order because you will need two rules eg:

=AND(B2<C2,C2<>"")
=AND(B2>C2,C2<>"")

applied to B2:E5

#### drewberts

##### Board Regular
You will have conflicting rules there. For example March 2018 would be both red and green. What takes precedent? Anyway you can change the order because you will need two rules eg:

=AND(B2<C2,C2<>"")
=AND(B2>C2,C2<>"")

applied to B2:E5
Thanks March 2018 will only be compared to March 2017 (the same month in the previous year). March 2019 will only be compared to March 2018 and so on.

#### steve the fish

##### Well-known Member
Sorry yes i just realised that. So you need just this:

=C2<B2
=C2>=B2

Applied to C2:E5

#### drewberts

##### Board Regular
Sorry yes i just realised that. So you need just this:

=C2<B2
=C2>=B2

Applied to C2:E5
Many thanks Steve - I get the relative cell references now. I was massively trying to over think this. However, without moving the goal posts I was simply going to apply this to Icon sets - but relative cell refs don't work with this. Therefore I presume a completely different approach is needed if I wanted to go down that route (cell fill colours make the data far to complicated to read)?

Replies
20
Views
311
Replies
0
Views
67
Replies
3
Views
173
Replies
7
Views
61
Replies
3
Views
169

1,127,557
Messages
5,625,501
Members
416,114
Latest member
Ayush_123

### 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.

### Which adblocker are you using?

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

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