+ Reply to Thread
Results 1 to 4 of 4

Extract Text from String then Convert to a Date (Month/Year)

  1. #1
    Registered User
    Join Date
    02-09-2010
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    5

    Extract Text from String then Convert to a Date (Month/Year)

    I have the following text in a cell A1: "ACTD 12/12" and I want to convert this into a date (to be used in a lookup formula). I have a formula in cell B1 that reads: =RIGHT(+a1,5). This returns the following: 12/12. However, when I try to convert the result of 12/12 (in cell B1) to a date, it returns the current year of 2013 rather that the year of 2012. How do I get formula to read the last 2 digits as the year represented (instead of the current year)? I have additional cells in my spreadsheets with other years (like ACTD 6/11, ACTD 5/10, etc.) - so I really need a formula to remove the "ACTD" and then read the numbers and convert to appropriate month/year. Any help would be greatly appreciated. Thanks.

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Extract Text from String then Convert to a Date (Month/Year)

    Assuming the dates are all after 2000... and that you want the first of the month... try:

    =DATE(("20"&RIGHT(A1,2))+0,LEFT(RIGHT(A1,5),2)+0,1)

    copied down
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Registered User
    Join Date
    12-22-2012
    Location
    Richmond, NSW, Australia
    MS-Off Ver
    Excel 2003 Excel 2007 Excel 2010 Excel 2013
    Posts
    13

    Re: Extract Text from String then Convert to a Date (Month/Year)

    I'm sure that this cat can be skinned many ways. But:

    For last of month:
    =DATE(RIGHT(A1,2)+100,LEFT(RIGHT(A1,5),2)+1,0)
    For first of month:
    =DATE(RIGHT(A1,2)+100,LEFT(RIGHT(A1,5),2),1)

  4. #4
    Banned User!
    Join Date
    10-14-2006
    Posts
    1,211

    Re: Extract Text from String then Convert to a Date (Month/Year)

    =substitute(right(a1,5),"/","/1/")+0

+ 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