i want to highlight close occurring dates in yellow

sleek12

Board Regular
Joined
May 3, 2014
Messages
72
Office Version
  1. 365
Platform
  1. Windows
I want the date in column I to highlight in yellow with column L:Y to highlight in yellow as well , eg if the date in column I is 14/12/2023 then to highlight in yellow if the date is 2 days back or 3 days front , 12/12/2023,13/12/2023,15/12/2023/16/12/2023/17/12/2023. i am using office 365, formula, power query ,LET, lambda, VBA macros are ok
38205C28716907Q-JB0765Type C - Private CarTrident Insurance Company Ltd.DIRECTLucyMakenaPAUL KURIA WAWERU
column I
14/12/2023​
08007018565252023KBK972E
column L
23/01/2024​
column M
23/01/2024​
and so forth...
16/01/2024​
03/01/2024​
38067C28716898Q-JB0608Type C - Private CarTrident Insurance Company Ltd.DIRECTLucyMakenaZACHARIAH MUTHII KABUGA
14/12/2023​
08007018565232023KAD480C
29/01/2024​
24/01/2024​
16/01/2024​
21/12/2023​
14/11/2023​
36701C28716235Q-JA8855Type C - Private CarTrident Insurance Company Ltd.DIRECTLucyMakenaELIAS KINYUA KIUGU
14/12/2023​
08007017744412023KAX033G
13/01/2024​
12/01/2024​
13/01/2024​
12/01/2024​
10449B13355322Q-JB7516Type B - Commercial VehicleTrident Insurance Company Ltd.DIRECTLucyMakenaKINYUA ERIC MAWIRA
15/12/2023​
08008013526522023KBH624S
12/01/2024​
12/01/2024​
11700B13357275Q-JC1980Type B - Commercial VehicleTrident Insurance Company Ltd.DIRECTLucyMakenaJOHN KABURU
15/12/2023​
08008013625422023KAR025P
21/12/2023​
15/12/2023​
05/12/2023​
53498C28724678Q-JC3901Type C - Private CarTrident Insurance Company Ltd.DIRECTLucyMakenaERIC MUTUMA
15/12/2023​
08007018339942023KAV81OA
29/11/2023​
53193C28724649Q-JC3716Type C - Private CarTrident Insurance Company Ltd.DIRECTLucyMakenaPETER ROY BUNDI KIMEU
15/12/2023​
08007018545522023KAY995R
13/01/2024​
13/01/2024​
11/11/2023​
10/11/2023​
53157C28724644Q-JC3664Type C - Private CarTrident Insurance Company Ltd.DIRECTLucyMakenaREV.NICHOLAS MWENDA BIRITHU
15/12/2023​
08007017440722023KDH038Nnot found
53070C28724637Q-JC3615Type C - Private CarTrident Insurance Company Ltd.DIRECTLucyMakenaCHARLES MATHIU KIRIMI
15/12/2023​
08007018565242023KDB882R
11/01/2024​
11/01/2024​
29/11/2023​
52413C28724320Q-JC2948Type C - Private CarTrident Insurance Company Ltd.DIRECTLucyMakenaNAOMI LEKISAAT
15/12/2023​
08007018562532023KBL593C
24/01/2024​
24/11/2023​
02/11/2023​
51981C28723899Q-JC2525Type C - Private CarTrident Insurance Company Ltd.DIRECTLucyMakenaGODFFREY MITHIKA THAIRU
15/12/2023​
08007113526652023KMGK696Unot found
44568C28718870Q-JB7410Type C - Private CarTrident Insurance Company Ltd.DIRECTLucyMakenaBENJAMIN PAUL MUKORA
15/12/2023​
08007016393432022KAX088Z
13/01/2024​
12/01/2024​
13/01/2024​
12/01/2024​
42967C28718709Q-JB6288Type C - Private CarTrident Insurance Company Ltd.DIRECTLucyMakenaWILSON GATOBU MBWIRIA
15/12/2023​
08007017817732023KSF713not found
42940C28718703Q-JB6251Type C - Private CarTrident Insurance Company Ltd.DIRECTLucyMakenaMARTIN MURITHI GIOTIMIBU
15/12/2023​
08007018525652023KBQ683B
23/01/2024​
16/01/2024​
09/01/2024​
25/11/2023​
03/11/2023​
42302C28718538Q-JB5804Type C - Private CarTrident Insurance Company Ltd.DIRECTLucyMakenaMICHAEL KINYUA
15/12/2023​
08007018516402023KAD734L
29/01/2024​
24/01/2024​
16/01/2024​
21/12/2023​
14/11/2023​
 
Last edited:

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
is it exactly 2 days and 3 days and NOT between -2 to 3 days
if the latter
=AND($I$2-L2>-2,$I$2-L2<3)

for 2007, 2010 , 2013 , 2016 , 2019 or 365 Subscription excel version
Conditional Formatting

Highlight applicable range >>
L2:Y100 - Change, reduce or extend the rows to meet your data range of rows

Home Tab >> Styles >> Conditional Formatting
New Rule >> Use a formula to determine which cells to format
Edit the Rule Description: Format values where this formula is true:

=AND($I$2-L2>-2,$I$2-L2<3)

Format [Number, Font, Border, Fill]
choose the format you would like to apply when the condition is true
OK >> OK

ONLY 1 in the sample meets that

Book5
ABCDEFGHIJKLMNOP
138205C28716907Q-JB0765Type C - Private CarTrident Insurance Company Ltd.LucyMakenaPAUL KURIA WAWERUcolumn IKBK972Ecolumn Lcolumn Mand so forth...1/3/24
212/14/231/23/241/23/241/16/24
338067C28716898Q-JB0608Type C - Private CarTrident Insurance Company Ltd.LucyMakenaZACHARIAH MUTHII KABUGA12/14/23KAD480C1/29/241/24/241/16/2412/21/2311/14/23
436701C28716235Q-JA8855Type C - Private CarTrident Insurance Company Ltd.LucyMakenaELIAS KINYUA KIUGU12/14/23KAX033G1/13/241/12/241/13/241/12/24
510449B13355322Q-JB7516Type B - Commercial VehicleTrident Insurance Company Ltd.LucyMakenaKINYUA ERIC MAWIRA12/15/23KBH624S1/12/241/12/24
611700B13357275Q-JC1980Type B - Commercial VehicleTrident Insurance Company Ltd.LucyMakenaJOHN KABURU12/15/23KAR025P12/21/2312/15/2312/5/23
753498C28724678Q-JC3901Type C - Private CarTrident Insurance Company Ltd.LucyMakenaERIC MUTUMA12/15/23KAV81OA11/29/23
853193C28724649Q-JC3716Type C - Private CarTrident Insurance Company Ltd.LucyMakenaPETER ROY BUNDI KIMEU12/15/23KAY995R1/13/241/13/2411/11/2311/10/23
953157C28724644Q-JC3664Type C - Private CarTrident Insurance Company Ltd.LucyMakenaREV.NICHOLAS MWENDA BIRITHU12/15/23KDH038Nnot found
1053070C28724637Q-JC3615Type C - Private CarTrident Insurance Company Ltd.LucyMakenaCHARLES MATHIU KIRIMI12/15/23KDB882R1/11/241/11/2411/29/23
1152413C28724320Q-JC2948Type C - Private CarTrident Insurance Company Ltd.LucyMakenaNAOMI LEKISAAT12/15/23KBL593C1/24/2411/24/2311/2/23
1251981C28723899Q-JC2525Type C - Private CarTrident Insurance Company Ltd.LucyMakenaGODFFREY MITHIKA THAIRU12/15/23KMGK696Unot found
1344568C28718870Q-JB7410Type C - Private CarTrident Insurance Company Ltd.LucyMakenaBENJAMIN PAUL MUKORA12/15/23KAX088Z1/13/241/12/241/13/241/12/24
1442967C28718709Q-JB6288Type C - Private CarTrident Insurance Company Ltd.LucyMakenaWILSON GATOBU MBWIRIA12/15/23KSF713not found
1542940C28718703Q-JB6251Type C - Private CarTrident Insurance Company Ltd.LucyMakenaMARTIN MURITHI GIOTIMIBU12/15/23KBQ683B1/23/241/16/241/9/2411/25/2311/3/23
1642302C28718538Q-JB5804Type C - Private CarTrident Insurance Company Ltd.LucyMakenaMICHAEL KINYUA12/15/23KAD734L1/29/241/24/241/16/2412/21/2311/14/23
Sheet1
Cells with Conditional Formatting
CellConditionCell FormatStop If True
L2:Y16Expression=AND($I$2-L2>-2,$I$2-L2<3)textNO
 
Last edited:
Upvote 0
ummm.... maybe i am going wrong somewhere ??

lucymakenadec2024query (1) (2).xlsm
IJKLMNOPQR
7719/12/202308007018554212023KCJ902R23/01/202420/12/202313/12/202305/12/202316/11/202309/11/202309/11/2023
7819/12/202308007018541372023KDB451E11/01/202411/01/202429/11/2023
7919/12/202308007018552492023KCK647G14/12/202303/11/2023
8019/12/202308007018552512023KAM207E02/12/2023
8120/12/202308007018561452023KAL458F22/12/202304/12/2023
8220/12/202308007018566552023KCT498E08/01/202406/12/2023
8320/12/20230800701245632023KBN469G26/01/202428/12/202330/11/2023
partialmatches
Cells with Conditional Formatting
CellConditionCell FormatStop If True
L2:Y236Expression=AND($I$2-L2>=-2,$I$2-L2<=3)textNO
 
Upvote 0
Yes , you have I2 fixed at I2, so every row & column is comapred to L2 only
$I$2
and should be
$I2, so rows can change and be compared

time may have an issue , should not be - but as you do have a time in the cells then

=AND($I2-INT(L2)>=-2,$I2-INT(L2)<=3)

I have copied into row77 - and used that as the selection and formula - just for your example
see red


Book7
IJKLMNOPQR
7712/19/238.00702E+15KCJ902R1/23/2412/20/2312/13/2312/5/2311/16/2311/9/2311/9/23
7812/19/238.00702E+15KDB451E1/11/241/11/2411/29/23
7912/19/238.00702E+15KCK647G12/14/2311/3/23
8012/19/238.00702E+15KAM207E12/2/23
8112/20/238.00702E+15KAL458F12/22/2312/4/23
8212/20/238.00702E+15KCT498E1/8/2412/6/23
8312/20/238.00701E+14KBN469G1/26/2412/28/2311/30/23
Sheet1
Cells with Conditional Formatting
CellConditionCell FormatStop If True
L77:R83Expression=AND($I77-INT(L77)>=-2,$I77-INT(L77)<=3)textYES
 
Upvote 0

Forum statistics

Threads
1,224,816
Messages
6,181,141
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