Highlight duplicates based on date range in another column

neilskinner

New Member
Joined
Apr 25, 2022
Messages
9
Office Version
  1. 2010
Platform
  1. Windows
Hello,

Can anyone help me with a conditional formatting formula to highlight duplicate data in column H, but only if data in Column I (dates) are at least 2 weeks apart? We are keeping track on railcar numbers and their dates of arrival. If there is a duplicate entry of a railcar but the arrival dates are greater than two weeks apart, we know that this is accurate. However, if arrival dates are within two weeks we know that this data is duplicated and should be highlighted. Any help would be greatly appreciated!
 
In my original formula, I had to find a way to not compare a row with itself, so I told it to ignore a row if it had the same date. Which as you found out will prevent some rows from highlighting. I found another way to do that, and as a benefit it's a shorter formula, so it should be more efficient:

Book1
HIJK
1RAIL CARWEIGHTSTONSARRIVED
2ACFX 22012514785973.92951/11/2022
3ACFX 22013615088775.4435
4ADMX 101318595092.9754/4/2022
5ADMX 11218768093.84
6ADMX 2100519176095.883/30/2022
7ADMX 2101019174095.873/27/2022
8ADMX 2101018660093.34/2/2022
9ADMX 2543218636093.184/25/2022
10ADMX 2547518632093.164/13/2022
11ADMX 2561518672093.363/25/2022
12ADMX 2582818714093.574/4/2022
13ADMX 2619818672093.364/17/2022
14ADMX 2641318648093.243/30/2022
15ADMX 3026719628098.14
16ADMX 3027319674098.374/21/2022
17ADMX 30731221160110.58
18ADMX 30733220200110.14/13/2022
19ADMX 30734221240110.624/6/2022
20ADMX 30796221180110.594/21/2022
21ADMX 30920221160110.584/1/2022
22ADMX 30938220240110.124/8/2022
23ADMX 30949221120110.564/6/2022
24ADMX 30998221120110.564/8/2022
25ADMX 31045221180110.594/17/2022
26ADMX 1013220780110.394/2/2022
27ADMX 30920220260110.134/1/2022
28ADMX 31076220820110.413/25/2022
29ADMX 31114220640110.32
30ADMX 31180221480110.743/20/2022
31ADMX 3119019810099.054/17/2022
32ADMX 31224221400110.74/2/2022
33ADMX 31228220920110.463/19/2022
34ADMX 31256220660110.33
35ADMX 31280221340110.673/27/2022
36ADMX 31280220820110.41
37
38
Sheet12
Cell Formulas
RangeFormula
J2:J36J2=I2/2000
Cells with Conditional Formatting
CellConditionCell FormatStop If True
H1:H20000Expression=(H1<>"")*(K1<>"")*(MIN(ABS(K1-IF(H1=H$1:H$20000,IF(ROW()<>ROW(H$1:H$20000),K$1:K$20000))))<14)textNO


Let me know how this works.
 
Upvote 0

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)

Forum statistics

Threads
1,215,635
Messages
6,125,945
Members
449,275
Latest member
jacob_mcbride

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