Ask a Question Sign up for Free 111 Experts currently online. Ask Questions for Free!

How to convert mm/dd/yyyy date format to yyyymmdd - Excel Setup

I have a cell with a custom date format of m/d/yyyy h:mm, I need to convert the date to yyyymmdd text. Does anyone have a VB macro code snippet to do something like this? I've tried text to columns but can't get it to work...any help is appreciated. Thanks....

Results 1 to 4 of 4

  1. #1

    How to convert mm/dd/yyyy date format to yyyymmdd

    I have a cell with a custom date format of m/d/yyyy h:mm,
    I need to convert the date to yyyymmdd text. Does anyone
    have a VB macro code snippet to do something like this?
    I've tried text to columns but can't get it to work...any
    help is appreciated.

    Thanks.
    Jeff
  2. #2

    Re: How to convert mm/dd/yyyy date format to yyyymmdd

    Hi Jeff,

    I can help with part of this - don't know if it will give u the end solution
    you want, though...

    I can help u get from m/d/yyyy to yyyymmdd.

    You say you already have a cell with "m/d/yyyy h:mm". Select that cell;
    press Ctrl+1 to access the Format dialogue box for that cell. Select the
    tab number. in the category box, select "custom". Then, in the "type" box,
    type "yyyymmdd" - just that. that will automatically change your m/d/yyyy
    to yyyymmdd. You can also copy this format to any other cell in that
    workbook to get from m/d/yyyy to yyyymmdd.

    I don't understand what you mean when you write that you want to get from
    the "h:mm" part to "text". What text exactly? It is possible to have Excel
    just lose the h:mm in the cell so that you go from m/d/yyyy h:mm to plain
    old yyyymmdd - but what's this text u want to add?

    Hope this is of some help,

    Richard.

    "Jeff" <com> wrote in message
    news:0ef101c34593$5b14ba60$gbl... 


    Richard
  3. #3

    Re: How to convert mm/dd/yyyy date format to yyyymmdd

    Using VBA, the command you want is:
    Range("C2")=Format(Range("B2"),"yyyymmdd").

    Kim

    "Richard Adrian" <com> wrote in message
    news:elDQr$phx.gbl... 
    solution 
    box, 
    Excel 


    Kim
  4. #4

    How to convert mm/dd/yyyy date format to yyyymmdd

    Can you not just format the cell using Custom format
    (Format>Cells>Custom Format) and type yyyymmdd ?

     
    Ian

Similar Threads

  1. Convert non-date string to a date
    By lunker55 in forum Microsoft Excel
    Replies: 14
    Last Post: 02-17, 08:32 PM
  2. Replies: 2
    Last Post: 02-09, 08:45 AM
  3. How to convert PDF document into WORD format?
    By Terry in forum Software Tools, Tips & Tricks
    Replies: 1
    Last Post: 09-01, 06:11 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100