+ Reply to Thread
Results 1 to 7 of 7

Highlight Duplicates Within on Proximity/Date

  1. #1
    Registered User
    Join Date
    03-03-2020
    Location
    Nashville, TN
    MS-Off Ver
    2019
    Posts
    3

    Highlight Duplicates Within on Proximity/Date

    Attached is my example sheet. My full worksheet has 30+ columns and 400+ rows. My goal is to highlight any cells that have a duplicate within 3 rows above or below them (1 week) in any column. Also don't highlight a cell if it has a duplicate in the same column.

    So far I tried conditional formatting and it got me close. But I would have to make hundreds of rules and I can't seem to have them overlap.
    I tried some formulas to show me the number of matches there are per row but it's not obvious enough and I'd like the cells highlighted.

    Is there a formula I can use in conditional formatting so I only have to make 1 rule for the whole sheet? Would a macro be the way to go here?
    Any help would be much appreciated.
    Attached Files Attached Files
    Last edited by thefrostman; 03-03-2020 at 01:27 PM.

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,167

    Re: Highlight Duplicates Within on Proximity/Date

    Hi frostman and welcome to the forum,

    I have a possible answer but don't like it. See the attached where I've used a countif formula across a range of cells. You may need the latest version of excel to do this formula in I2.
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Then to get a date range I've done it again to the right in column N but one row down, repeat 6 times. Then copy from I2 to AQ8 below the above block. OUCH!!

    Everywhere there is a 2 in the counter fields is where your answer lies.

    Question - Are you tracking in the same week? Could you put a new column of WeekNumber and track dups in the same week? Is this what you really want?

    Dups within 6 days.xlsx
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Registered User
    Join Date
    03-03-2020
    Location
    Nashville, TN
    MS-Off Ver
    2019
    Posts
    3

    Re: Highlight Duplicates Within on Proximity/Date

    That formula will highlight all duplicates within that range. I'm looking to narrow down the scope more.

    I don't want to only look at one week at a time, like every Sunday to Saturday. I want to look any cell with a duplicate within 3 rows above or below. The 7 total rows will be a weeks range but in reference to the target cell.

    My worksheet will have a lot of rows and cells so showing results to the side of it will be too much to look at. I think highlighting is the best way to easily find these.

  4. #4
    Registered User
    Join Date
    03-03-2020
    Location
    Nashville, TN
    MS-Off Ver
    2019
    Posts
    3

    Re: Highlight Duplicates Within on Proximity/Date

    I think there should be a way to do this with conditional formatting. I just need to find the right formula to highlight duplicates within the 3 rows above and below it and then apply that to the whole set of data. Thoughts?

  5. #5
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,167

    Re: Highlight Duplicates Within on Proximity/Date

    Hey,

    What happens if you have a duplicate 3 rows above and it shows using CF. Then the same happens 4 rows below. That city will be CF twice, once from above and once from below. You will have no idea which are duplicates of which. Even if you change colors of the CF it won't help as the last format will win.

    I think you'd have better luck by arranging your data in 3 columns: Date, Client, City. Then you might come up with a formula using date range and CountIF() that would give an answer you could live with. I don't think a CF answer lives with the data as you've arranged it.

    Maybe one of the smart Guru's can give a CF answer that I can't imagine...

  6. #6
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,532

    Re: Highlight Duplicates Within on Proximity/Date

    This proposal employs five helper columns which may be moved and/or hidden for aesthetic purposes.
    1. Column I produces a list of locations using*: =IFERROR(INDIRECT(TEXT(SMALL(IF((C$2:G$31<>""),ROW(A$2:A$31)*100+COLUMN(C$1:G$1),10^10),ROWS(A$1:A1)),"R0C00"),)&"","")
    2. Column J produces a list of corresponding clients using*: =IF(I2="","",INDEX(A$1:G$1,IFERROR(VALUE(RIGHT(TEXT(SMALL(IF((C$2:G$31<>""),ROW(A$2:A$31)*100+COLUMN(C$1:G$1),10^10),ROWS(A$1:A1)),"R0C00"),2)),"")))
    3. Column K produces a list of corresponding dates using: =IF(I2="","",INDEX(A$2:A$31,AGGREGATE(15,6,(ROW(A$2:A$31)-COLUMN(A$1))/(C$2:G$31=I2),COUNTIFS(I$2:I2,I2))))
    4. Column L produces a list of number of duplicates within +/- three days using: =IF(I2="","",COUNTIFS(I$2:I$31,I2,J$2:J$31,"<>"&J2,K$2:K$31,">="&K2-3,K$2:K$31,"<="&K2+3))
    5. Column M produces a list of cell addresses that contain duplicates using: =IF(I2="","",IF(L2>0,ADDRESS(MATCH(K2,A$1:A$31,0),MATCH(J2,A$1:G$1,0)),""))
    The conditional formatting formula is: =COUNTIFS($M$2:$M$31,ADDRESS(ROW(),COLUMN()))
    *Denotes an array entered formula which is confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER.
    Let us know if you have any questions.
    Attached Files Attached Files
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

  7. #7
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,167

    Re: Highlight Duplicates Within on Proximity/Date

    Hi frostman,

    I see that a "Smart Guru" JeteMc figured your problem out above. It looks like he needed 5 helper columns and lots of CSE Array formulas. Does this solve your problem?

    Marv

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Conditional Formatting for Date Proximity
    By Jeniji in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-08-2019, 09:48 PM
  2. [SOLVED] Need to output 3 different results based on proximity to current date
    By knight3330 in forum Excel General
    Replies: 5
    Last Post: 08-18-2019, 11:28 AM
  3. [SOLVED] Highlight Duplicates between Sheet1 and Sheet2, ignoring duplicates already in Sheet1
    By KariSaga in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 04-04-2019, 05:06 AM
  4. highlight duplicates
    By dulitul19 in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 03-05-2013, 06:34 AM
  5. Highlight Duplicates
    By bopsgtir in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-17-2012, 10:17 AM
  6. Macro to check for duplicates and highlight duplicates
    By obc1126 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-23-2008, 09:55 PM
  7. multiple criteria conditional format with date proximity
    By B. Baumgartner in forum Excel General
    Replies: 3
    Last Post: 01-13-2007, 08:31 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1