Conditional formatting is not quite right

C with no eyes

Board Regular
Joined
Nov 26, 2016
Messages
152
[TABLE="width: 965"]
<tbody>[TR]
[TD]period from[/TD]
[TD]period to[/TD]
[TD]date posted[/TD]
[TD]breakdown total[/TD]
[TD]Nov-18[/TD]
[TD]Dec-18[/TD]
[TD]Jan-19[/TD]
[TD]Feb-19[/TD]
[TD]Mar-19[/TD]
[TD]Apr-19[/TD]
[TD]May-19[/TD]
[/TR]
[TR]
[TD]17/10/18[/TD]
[TD]16/10/20[/TD]
[TD]01/11/18[/TD]
[TD] £ 9.99[/TD]
[TD] £ 0.41[/TD]
[TD] £ 0.41[/TD]
[TD] £ 0.41[/TD]
[TD] £ 0.41[/TD]
[TD] £ 0.41[/TD]
[TD] £ 0.41[/TD]
[TD] £ 0.41[/TD]
[/TR]
[TR]
[TD]19/11/18[/TD]
[TD]16/12/18[/TD]
[TD]14/12/18[/TD]
[TD] £ 2,400.00[/TD]
[TD] £ 1,200.00[/TD]
[TD] £ 1,200.00[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]17/12/18[/TD]
[TD]11/01/19[/TD]
[TD]10/01/19[/TD]
[TD] £ 2,400.00[/TD]
[TD][/TD]
[TD] £ 1,200.00[/TD]
[TD] £ 1,200.00[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]01/01/19[/TD]
[TD]31/12/19[/TD]
[TD]31/12/19[/TD]
[TD] £ 90.75[/TD]
[TD][/TD]
[TD][/TD]
[TD] £ 7.57[/TD]
[TD] £ 7.57[/TD]
[TD] £ 7.57[/TD]
[TD] £ 7.56[/TD]
[TD] £ 7.56[/TD]
[/TR]
[TR]
[TD]23/10/18[/TD]
[TD]22/10/19[/TD]
[TD]01/11/18[/TD]
[TD] £ 739.00[/TD]
[TD] £ 61.59[/TD]
[TD] £ 61.59[/TD]
[TD] £ 61.59[/TD]
[TD] £ 61.59[/TD]
[TD] £ 61.58[/TD]
[TD] £ 61.58[/TD]
[TD] £ 61.58[/TD]
[/TR]
[TR]
[TD]01/02/19[/TD]
[TD]28/02/19[/TD]
[TD]20/01/19[/TD]
[TD] £ 280.00[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD] £ 280.00[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]01/11/18[/TD]
[TD]31/10/19[/TD]
[TD]21/11/18[/TD]
[TD] £ 750.00[/TD]
[TD] £ 62.50[/TD]
[TD] £ 62.50[/TD]
[TD] £ 62.50[/TD]
[TD] £ 62.50[/TD]
[TD] £ 62.50[/TD]
[TD] £ 62.50[/TD]
[TD] £ 62.50[/TD]
[/TR]
[TR]
[TD]01/11/18[/TD]
[TD]31/10/19[/TD]
[TD]21/11/18[/TD]
[TD] £ 11,580.00[/TD]
[TD] £ 965.00[/TD]
[TD] £ 965.00[/TD]
[TD] £ 965.00[/TD]
[TD] £ 965.00[/TD]
[TD] £ 965.00[/TD]
[TD] £ 965.00[/TD]
[TD] £ 965.00[/TD]
[/TR]
[TR]
[TD]01/11/18[/TD]
[TD]31/10/19[/TD]
[TD]21/11/18[/TD]
[TD] £ 616.50[/TD]
[TD] £ 51.37[/TD]
[TD] £ 51.37[/TD]
[TD] £ 51.37[/TD]
[TD] £ 51.37[/TD]
[TD] £ 51.37[/TD]
[TD] £ 51.37[/TD]
[TD] £ 51.38[/TD]
[/TR]
[TR]
[TD]01/11/18[/TD]
[TD]31/12/18[/TD]
[TD]14/01/19[/TD]
[TD] £ 56.66[/TD]
[TD] £ 28.33[/TD]
[TD] £ 28.33[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]01/11/18[/TD]
[TD]31/12/18[/TD]
[TD]14/01/19[/TD]
[TD] £ 1,352.34[/TD]
[TD] £ 676.17[/TD]
[TD] £ 676.17[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]01/11/18[/TD]
[TD]31/12/18[/TD]
[TD]14/01/19[/TD]
[TD] £ 186.76[/TD]
[TD] £ 93.38[/TD]
[TD] £ 93.38[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]01/11/18[/TD]
[TD]31/12/18[/TD]
[TD]14/01/19[/TD]
[TD] £ 85.86[/TD]
[TD] £ 42.93[/TD]
[TD] £ 42.93[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]03/11/18[/TD]
[TD]21/12/18[/TD]
[TD]22/01/19[/TD]
[TD] £ 1,230.38[/TD]
[TD] £ 505.75[/TD]
[TD] £ 724.63[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]01/11/18[/TD]
[TD]29/11/18[/TD]
[TD]22/01/19[/TD]
[TD] £ 64.05[/TD]
[TD] £ 64.05[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]06/12/18[/TD]
[TD]28/12/18[/TD]
[TD]22/01/19[/TD]
[TD] £ 51.24[/TD]
[TD][/TD]
[TD] £ 51.24[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]


Above is a snippet of some info that starts at column D.

I have applied the following conditional formatting to =$H:$AE

=AND(MONTH(H$1)>=MONTH($D1),YEAR(H$1)>=YEAR($D1),MONTH(H$1)<=MONTH($E1),YEAR(H$1)<=YEAR($E1))

I want it to highlight cells that relate to the period dates i.e. the first row should be highlighted from Oct18 to Oct20. The second row should be highlighted from Nov18 to Dec18.

It's working on most rows but not all. What am I missing?

Thanks
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
How about
=AND(EOMONTH(H$1,-1)+1>=EOMONTH($D1,-1)+1,EOMONTH(H$1,0)<=EOMONTH($E1,0))
 
Upvote 0
That works beautifully, thank you very much. Still can't see what was wrong with mine though and it's going to bug me until I know why!!
 
Upvote 0
When looking at row2 part of your formula is
MONTH(H$1)<=MONTH($E2)
This returns FALSE as Nov is not <= Oct
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,337
Members
452,637
Latest member
Ezio2866

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