Cond. format empty cell based on column header and dates in other cells

haruspication

New Member
Joined
Jan 19, 2012
Messages
17
Hello excel enthusiasts,

I want to use a conditional formatting formula to highlight empty cells that fall between the first and last harvest period for each crop based on the column header date. The cells that should be highlighted say "fill". I've tried if/and formulas using relative cells, but haven't gotten it to work. Any suggestions?

For example, I applied conditional formatting to cell D2:J2 with the formula below, but nothing happened: =AND(D$1>=$B2,D$1<=$C2).


[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD][/TD]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[TD]E[/TD]
[TD]F[/TD]
[TD]G[/TD]
[TD]H[/TD]
[TD]I[/TD]
[TD]J[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Crop[/TD]
[TD]First Harvest[/TD]
[TD]Last Harvest[/TD]
[TD]10-Apr[/TD]
[TD]17-Apr[/TD]
[TD]24-Apr[/TD]
[TD]1-May[/TD]
[TD]8-May[/TD]
[TD]15-May[/TD]
[TD]22-May[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]Asparagus[/TD]
[TD]17-Apr[/TD]
[TD]8-May[/TD]
[TD][/TD]
[TD]fill[/TD]
[TD]fill[/TD]
[TD]fill[/TD]
[TD]fill[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]Turnips[/TD]
[TD]1-May[/TD]
[TD]15-May[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]fill[/TD]
[TD]fill[/TD]
[TD]fill[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
 
Last edited:

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
I figured it out! In my formula, excel did not convert the column header dates into serial numbers, however excel did convert the dates in column B & C into serial numbers. So, I adjusted the formula so that the column header dates became serial numbers and the formula worked perfectly.

AND(datevalue(D$1)>=$B2,datevalue(D$1)<=$C2)
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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