+ Reply to Thread
Results 1 to 6 of 6

Formula to Extract Date

  1. #1
    Registered User
    Join Date
    11-12-2007
    Posts
    10

    Formula to Extract Date

    Hey,

    I am creating an invoice worksheet which has orders with date and time details e.g. in the form 2006/12/03 at 22:15. I would like to extract the month and year from this data e.g. in the format 12/06, and display this in another cell in the worksheet. I am unsure of the code that would allow me to do this and would be grateful for any suggestions!

    Thanks,

    Ben

  2. #2
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675
    Will a formula do? If date/time is in A1 try

    =TEXT(A1,"m/y")

  3. #3
    Registered User
    Join Date
    11-12-2007
    Posts
    10
    Sorry i meant to say formula That formula doesn't seem to work, it just reproduces the same data rather than copying the month and year only.

  4. #4
    Registered User
    Join Date
    11-12-2007
    Posts
    10
    It works if i remove the time part e.g. 2006/12/03 at 22:15, but I would rather keep the date and time together.

  5. #5
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675
    OK, I assumed you had a recognisable date/time format in the source cell, not text.

    Assuming you always show the date with two digits for month and year try

    =TEXT(LEFT(A1,10),"m/y")

    or if you might show the month or day as single digits

    =TEXT(LEFT(A1,FIND(" ",A1)-1),"m/y")

  6. #6
    Registered User
    Join Date
    11-12-2007
    Posts
    10
    Thank you for your help - the formula works perfectly!

    Ben

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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