+ Reply to Thread
Results 1 to 5 of 5

Macro to remove text after date

  1. #1
    Registered User
    Join Date
    05-15-2014
    MS-Off Ver
    Excel 2003
    Posts
    8

    Macro to remove text after date

    Hello all,

    I have found all kinds of find & replace samples, but nothing to delete text after a certain character count...

    My sheet contains a column R with date stamps:

    2020-05-04T18:31:53.280Z
    2020-05-01T23:10:06.774Z
    2020-04-17T23:02:57.912Z

    I'm looking for a macro that removes everything after and including the letter T (it's always the 11th character)

    2020-05-04
    2020-05-01
    2020-04-17

    Thank you in advance for your help!

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

    Re: Macro to remove text after date

    Hi polaon,

    You could use the Left() function in another column and extract those dates. Some thing like:

    =Left(A1,10)

    If you do this to another column and the copy and paste values only over the formulas they will remain. You might also want to change them to real dates by adding a zero..??
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: Macro to remove text after date

    If A1 = 2020-05-04T18:31:53.280Z
    and if left(A1,10) does not work then we need an Excel sample of your data ...!
    - Battle without fear gives no glory - Just try

  4. #4
    Registered User
    Join Date
    05-15-2014
    MS-Off Ver
    Excel 2003
    Posts
    8

    SOLVED: Macro to remove text after date

    Thank you both, the Left() function did the trick! I was overcomplicating it in my mind.

  5. #5
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,410

    Re: Macro to remove text after date

    You could also have used the Text To Columns dialog box by selecting Column R and then choosing Delimited in the first dialog page, then in the second dialog page uncheck all the checkboxes, then put a check mark in the "Other" checkbox and put an upper case T in the empty field next to it, then in the third dialog page, select the second column in the table and then click the "Do Not Import" optionbutton, then click the Finish button.

+ 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] Macro to remove time from date
    By _H_ in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-14-2020, 08:57 AM
  2. Macro to remove text and rearrange a text string
    By Shyatt in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-24-2017, 03:31 PM
  3. [SOLVED] Remove specific text from a cell and than sort cells by month and date
    By Boo123 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-10-2014, 05:05 PM
  4. [SOLVED] Need macro to remove numbers from text?
    By catmomma in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 08-14-2013, 04:10 AM
  5. [SOLVED] remove date/time from text string
    By dan23njguy in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-24-2012, 12:05 AM
  6. [SOLVED] Remove time from date macro
    By jockey in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-14-2012, 06:41 AM
  7. Macro to remove text
    By Terry Pinnell in forum Excel General
    Replies: 5
    Last Post: 10-21-2005, 07:05 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