+ Reply to Thread
Results 1 to 4 of 4

Compare two columns and remove duplicate data without leaving a blank space

  1. #1
    Registered User
    Join Date
    03-27-2020
    Location
    Canada
    MS-Off Ver
    2013 and 365
    Posts
    23

    Compare two columns and remove duplicate data without leaving a blank space

    Hi all-

    I am trying to make a custom work week calendar that removes weekends and custom holidays. I was able to get rid of weekends easy enough, but I am thus far unable to remove the custom holiday list from the work weeks.

    I ONLY want a list of non-holiday, non-weekends.

    I have tried two formulae to remove the custom holidays listed in column d.

    The MOST successful formulae is:
    =INDEX($E$3:$E$328,AGGREGATE(15,3,($E$3:$E$328<>$D3)/($E$3:$E$328<>$D3)*(ROW($E$3:$E$328)),ROWS(H3:$H$3)))

    This ^^ formula made the list in column F of the example spreadsheet. I have highlight all the values in column F that SHOULD have been removed from this list, as they are in the list of holidays.

    =IFERROR(LOOKUP(2,1/(COUNTIF(F3:$F$3,$E$328)=0),$E$328),LOOKUP(2,1/(COUNTIF(F3:$F$3,$D$3:$D$30)=0),$D$3:$D$30))

    This formula is in cell G3 of the example spreadsheet and you can see that it is right out to lunch.

    Thanks!
    Attached Files Attached Files

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,719

    Re: Compare two columns and remove duplicate data without leaving a blank space

    08 January 2020 is NOT listed as a holiday, though - 08 January 2021 is.

    Anyway, try this in J3 drag copied down:

    =WORKDAY.INTL($A$3,ROW(J3)-2,1,$D$3:$D$30)

    Format the cell as a date, obviously.
    Attached Files Attached Files
    Last edited by AliGW; 04-12-2020 at 03:07 AM.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Registered User
    Join Date
    03-27-2020
    Location
    Canada
    MS-Off Ver
    2013 and 365
    Posts
    23

    Re: Compare two columns and remove duplicate data without leaving a blank space

    That worked perfectly! Thanks!

    Can I ask for a bit more explanation so I can replicate this formula in other sheets later if I need it?

    Specifically for the " number of days" argument the Workday formula requires? You have a blank cell selected for row, -2. It's the minus 2 I am curious about as to why it is necessary.

    Thanks!

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,719

    Re: Compare two columns and remove duplicate data without leaving a blank space

    So, this bit:

    ROW(J3)-2

    looks at the row that J3 is on and returns 3, then takes away 2 - this leaves 1. This means that the formula will find the first day after the start date in A3 that is a working day.

    As you drag copy down, this number increments one at a time, so each row returns the next working day and then the next and the next and so on.

    Hope this helps.

    =WORKDAY.INTL($A$3,ROW(J3)-2,1,$D$3:$D$30)

    Sets weekend as Saturday and Sunday.

    =WORKDAY.INTL($A$3,ROW(J3)-2,1,$D$3:$D$30)

    References holiday dates.

    I presume you know about the Evaluate Formula feature on the Formulas ribbon?

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.
    Last edited by AliGW; 04-12-2020 at 11:56 AM.

+ 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. leaving a space blank untill all data is inputed
    By Jtwanabe in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 01-17-2018, 12:12 PM
  2. Code to remove compare and remove duplicate value between 2 columns
    By winmaxservices1 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-22-2015, 02:30 PM
  3. [SOLVED] Macro to remove duplicate rows leaving only 1 row for each different ROW.
    By JRidge in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-16-2014, 10:44 AM
  4. Replies: 3
    Last Post: 10-21-2013, 06:54 AM
  5. Replies: 3
    Last Post: 06-06-2013, 01:22 AM
  6. MACRO - Unmerge cells and delete blank columns, leaving data colum
    By Alex Sander in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-08-2006, 07:15 AM
  7. Replies: 1
    Last Post: 04-01-2005, 07:06 PM

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