Conditional format with LEFT, LEN, FIND and WEEKNUM

blbat

Active Member
Joined
Mar 24, 2010
Messages
338
Office Version
  1. 2016
  2. 2013
=LEFT($O2,LEN($O2)-FIND("-", $O2))*1=WEEKNUM(TODAY()*1)
(this formula returns FALSE if entered in a cell, but does not work in conditional format dialog box.)

Cell O2 Contains date values entered as: 03/30/2022-05/25/2022

if the first date is in current week I want to highlight the cell with yellow.

any help would be appreciated!
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Hi,

If your cell values are Always in that Exact format (e.g. mm/dd/yyyy-mm/dd/yyyy)

Book3.xlsx
O
1
203/30/2022-05/25/2022
304/08/2022-06/25/2022
Sheet1072
Cells with Conditional Formatting
CellConditionCell FormatStop If True
O2:O3Expression=WEEKNUM(LEFT(O2,10))=WEEKNUM(TODAY())textNO


If the format may differ, as in my sample O3 below, then use this:

Book3.xlsx
O
1
203/30/2022-05/25/2022
33/28/2022-06/25/2022
Sheet1072
Cells with Conditional Formatting
CellConditionCell FormatStop If True
O2:O3Expression=WEEKNUM(LEFT(O2,FIND("-",O2)-1))=WEEKNUM(TODAY())textNO
 
Upvote 0
Solution
Thanks!...will use the second formula, in case anyone enters dates without a preceding zero.
 
Upvote 0
You're welcome, thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,643
Messages
6,120,707
Members
448,981
Latest member
recon11bucks

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