+ Reply to Thread
Results 1 to 8 of 8

Remove value from list using loop

  1. #1
    Registered User
    Join Date
    07-12-2013
    Location
    US
    MS-Off Ver
    Excel 2007
    Posts
    27

    Remove value from list using loop

    In general I want to take a future single date i.e. (Wednesday, December 16, 2015) and create a list of dates dating back to the current date, that excludes the weekends. I'm sure there is a very easy way to do this using macros but I am still not very familiar with excel syntax. What i have created so far is a list that dates backwards but has weekends included, which is in column G. Then i created a list in column J that searches the text of the list in column G for either "Saturday" or "Sunday" and writes the word remove i.e.

    IF(OR(TEXT(G9,"dddd")="Saturday",TEXT(G9,"dddd")="Sunday")=TRUE,"remove",G9)

    Unfortunately i just want to remove that value in the list but do not know how. I have coded using python before and know this is extremely easy using a loop, again I just dont know the syntax of excel yet. Can someone help with the code or can it be done with just plain formula's?

    date forum example.xlsx

    -Jake

  2. #2
    Registered User
    Join Date
    09-27-2012
    Location
    Wisconsin
    MS-Off Ver
    Excel 2000
    Posts
    14

    Re: Remove value from list using loop

    Try this.

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    09-27-2012
    Location
    Wisconsin
    MS-Off Ver
    Excel 2000
    Posts
    14

    Re: Remove value from list using loop

    Nevermind, I didn't see your example before I did that. I fixed it, but as soon as it deleted a line, it screwed up the rest of the sheet because of the formula you used. I'll try this later. I think a macro might be unnecessary.

  4. #4
    Registered User
    Join Date
    09-27-2012
    Location
    Wisconsin
    MS-Off Ver
    Excel 2000
    Posts
    14

    Re: Remove value from list using loop

    date forum example.xlsx

    Here you go, no macro needed.

  5. #5
    Valued Forum Contributor
    Join Date
    03-29-2013
    Location
    United Kingdom
    MS-Off Ver
    Office/Excel 2013
    Posts
    1,749

    Re: Remove value from list

    date forum example.xlsm

    Try that.. The code is fairly simple and easy enough to modify
    Elegant Simplicity............. Not Always

  6. #6
    Forum Guru
    Join Date
    05-24-2011
    Location
    India
    MS-Off Ver
    365
    Posts
    2,242

    Re: Remove value from list

    Hello Hyatt;

    Take a look at WORKDAY function, which will exclude weekends; also HOLIDAYS if you have.

    G9, enter the start date, then in G10

    =WORKDAY(G$9,-ROWS(G$10:G10),Holidays)

    Copy down as needed. If you have any holidays enter those in a range & use that range in Holidays area. If you don't have delete those part.
    Regards,
    Haseeb Avarakkan

    __________________________________
    "Feedback is the breakfast of champions"

  7. #7
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Remove value from list using loop

    Jake, When you joined the forum recently you agreed to abide by the Forum Rules, but in haste I fear you might not have actually read them. Please stop and take a moment to read them now. We all follow these rules for the benefit of all, as must you. Thanks.

    (link above in the menu bar)


    Your duplicate posts did not comply with Rule 5 of our forum rules. Your duplicate threads were merged, somebody's time got wasted here.

    Threads Merged.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  8. #8
    Registered User
    Join Date
    07-12-2013
    Location
    US
    MS-Off Ver
    Excel 2007
    Posts
    27

    Re: Remove value from list using loop

    Sorry about the duplicate thing but I got it to work so Thank you everyone who posted!

    -Jake

+ 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. [SOLVED] how to remove the limit from any code in the FOR loop..
    By karanpreet in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-23-2013, 07:24 AM
  2. Remove characters using Loop?
    By noidea_4 in forum Excel Programming / VBA / Macros
    Replies: 20
    Last Post: 11-20-2012, 06:43 PM
  3. Loop through and remove dupliocate dates
    By Gman123 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-15-2011, 11:57 AM
  4. Remove duplicates loop through columns
    By closerb4 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-07-2011, 03:30 PM
  5. Loop through rows in a listbox and remove
    By Macdave_19 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-20-2008, 07:41 AM

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