If, then

hitman

New Member
Joined
Nov 26, 2009
Messages
19
I'm looking for an If/THEN formula. If B2:B100 is less than todays date, then shade cell grey.

In the photo, B4, B5 should be grey, B6 should be grey at midnight, and B7 should have no fill.

Every time I think excel can't do something, it can do that thing better. What do you have?
 

Attachments

  • Screenshot 2024-10-30 122719.jpg
    Screenshot 2024-10-30 122719.jpg
    13.1 KB · Views: 3

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Conditional Formatting, but why should B5 be gray? It's not less than today yet. Or did you mean less than or equal to?
Book1
B
210/29/2024
310/30/2024
410/31/2024
511/1/2024
611/2/2024
7
8
9
10
Sheet1
Cells with Conditional Formatting
CellConditionCell FormatStop If True
B2:B10Expression=AND(B2<TODAY(),B2<>"")textNO
 
Upvote 0
Conditional Formatting, but why should B5 be gray? It's not less than today yet. Or did you mean less than or equal to?
Book1
B
210/29/2024
310/30/2024
410/31/2024
511/1/2024
611/2/2024
7
8
9
10
Sheet1
Cells with Conditional Formatting
CellConditionCell FormatStop If True
B2:B10Expression=AND(B2<TODAY(),B2<>"")textNO
Yeah, B5 should be grey at midnight - my mistake
 
Upvote 0
Similar idea, but using NOW() to give the current date and time. It's not clear whether you want the current date (e.g., 30 Oct 2024) to be gray right now. Assuming the dates shown in your original post are midnight times, using NOW() as shown will turn a cell gray at midnight if the date shown in the cell is on or before midnight of the current date.
MrExcel_20241030.xlsx
B
1
2
3Date
410/29/2024
510/30/2024
610/31/2024
711/1/2024
811/2/2024
9
10
11
Sheet2
Cells with Conditional Formatting
CellConditionCell FormatStop If True
B4:B10Expression=AND(B4<=NOW(),B4<>"")textNO
 
Upvote 0

Forum statistics

Threads
1,224,818
Messages
6,181,152
Members
453,021
Latest member
Justyna P

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