+ Reply to Thread
Results 1 to 6 of 6

extract dates from column

  1. #1
    Registered User
    Join Date
    06-20-2014
    Location
    Houston, TX
    MS-Off Ver
    Office 365
    Posts
    47

    extract dates from column

    hello folks,

    I have a column of data that has mostly dates in it. however, some rows have dates with the format "09/02/2014 as of 09/01/2014". all other rows have a normal date in format "09/12/2014". I'd like to run through all the rows and check for the odd format and change it so that it reflects the first date shown. for example, the odd format "09/02/2014 as of 09/01/2014" would become "09/02/2014". all other column entries would have no change. this would be in VBA. I'm thinking some type of loop that uses the frequently seen LR variable to determine how many rows there are and some algorithm to correct the dates.

    thoughts?

    thank you for the help.

  2. #2
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,615

    Re: extract dates from column

    =iferror(datevalue(left(a1,10)),a1)
    Ben Van Johnson

  3. #3
    Valued Forum Contributor fredlo2010's Avatar
    Join Date
    07-04-2012
    Location
    Miami, United States
    MS-Off Ver
    Excel 365
    Posts
    762

    Re: extract dates from column

    Hi,

    Maybe a formula can do the job. Take a look at the formula I put together. I am using the space before " as of" as the guide to retrieve the first date. The formula is pointing to column A.

    Formula: copy to clipboard
    Please Login or Register  to view this content.



    Thanks

  4. #4
    Registered User
    Join Date
    06-20-2014
    Location
    Houston, TX
    MS-Off Ver
    Office 365
    Posts
    47

    Re: extract dates from column

    fred and leah,

    the formulas work; but how would I get them into VBA?

    thank you

  5. #5
    Valued Forum Contributor fredlo2010's Avatar
    Join Date
    07-04-2012
    Location
    Miami, United States
    MS-Off Ver
    Excel 365
    Posts
    762

    Re: extract dates from column

    If you want the transformation to be done in VBA. A formula will be a faster solution.

    Please Login or Register  to view this content.
    Thanks

  6. #6
    Registered User
    Join Date
    06-20-2014
    Location
    Houston, TX
    MS-Off Ver
    Office 365
    Posts
    47

    Re: extract dates from column

    ok folks. figured it out. I just used record macro, copied the formula down and that worked. thank you for all the help.

+ 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. extract dates from a column of numbers
    By freak11 in forum Excel General
    Replies: 10
    Last Post: 09-14-2013, 10:32 AM
  2. Code to Extract and Concatenate D/M/Y from Column of Julian Dates
    By anthony19 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-13-2012, 03:14 PM
  3. how to extract month from dates
    By perinouk in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 08-01-2007, 03:46 PM
  4. extract and sort dates
    By cityfc in forum Excel General
    Replies: 0
    Last Post: 01-11-2006, 04:10 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