+ Reply to Thread
Results 1 to 3 of 3

How to automatically delete rows in Excel based in day of week and date?

  1. #1
    Registered User
    Join Date
    08-04-2012
    Location
    Delft, Netherlands
    MS-Off Ver
    Excel 2007
    Posts
    1

    Question How to automatically delete rows in Excel based in day of week and date?

    Consider the following (partial) Excel worksheet:
    Please Login or Register  to view this content.
    In reality, there are over (the same) 500 dates for each of 100 companies (identified by id). I need to delete all rows which date falls on a saturday or sunday. In the example, March 12 and 13 (2011-03-12/13) and March 19 and 20 are Saturdays and Sundays. Second, I need to delete all rows with date 2011-07-04 (independence day; monday) and 2011-12-23 (friday before christmas).

    Is this possible to do with either a formula or VBScript? I have never written a VBScript macro before (I have never had a use for it) so I would appreciate some help.

  2. #2
    Valued Forum Contributor MaczaQ's Avatar
    Join Date
    06-03-2011
    Location
    Poland
    MS-Off Ver
    Excel 2003 / XP
    Posts
    510

    Re: How to automatically delete rows in Excel based in day of week and date?

    i suggest to add 1 more column and write formula which will check if date in column B is Saturday or Sunday. Then use autofilter and then delete them. The sam way for Independence day and Friday before Christams (autofilter on column B)

    You do not need any macro I think.
    Best Regards
    MaczaQ
    ---------------------------------------------------------------------------------------------------------------------------
    If you are satisfied with the solution(s) provided, please mark your thread as Solved
    If you are pleased with my answer consider to rate it. To thank someone who has helped you, click on the star icon below their name.
    - This way you will add him some reputation points ... thanks in advance.

  3. #3
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: How to automatically delete rows in Excel based in day of week and date?

    The WEEKDAY function will probably be useful to you as this will identify the day of the week on which a given date falls.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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