+ Reply to Thread
Results 1 to 7 of 7

Need to find a string of values on a cell and if found then write on colum

  1. #1
    Registered User
    Join Date
    03-10-2006
    Posts
    3

    Need to find a string of values on a cell and if found then write on colum

    Hello, need to convert a number into a year format. My cell contains for example 02-05 and this means years from 2002 to 2005. I would like to use a formula to identify several patterns and write the answer into columns. This is how I would write it, I know is not correct.

    if A1 contains 02-05, then write on B1 2002,2003,2004,2005. My ideal world would be to write into new columns, but if written as text into a single column, then I can extract.

    Thanks,

    Javier

  2. #2
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Need to find a string of values on a cell and if found then write on colum

    Will they always be at least the year 2000?
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  3. #3
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Need to find a string of values on a cell and if found then write on colum

    In B1 dragged to the right (you might need to reformat to General)
    =IF(LEFT($A$1,2)+COLUMN(A1)>(RIGHT($A$1,2)+1),"",(20 &LEFT($A$1,2))+COLUMN(A1)-1)
    Does that work for you?

  4. #4
    Registered User
    Join Date
    03-10-2006
    Posts
    3

    Re: Need to find a string of values on a cell and if found then write on colum

    Hello, well actually no, the years are all over the place its ranges from 73-2013 (1973-2013) and part number lines are like this:

    FENDER LH 07-11 SD

    Thanks

  5. #5
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Need to find a string of values on a cell and if found then write on colum

    Ahhh, so now a bit more difficult. and sometimes it has the full year (i.e. 73-2013) and sometimes it doesn't?!?
    Last edited by ChemistB; 04-24-2013 at 04:25 PM.

  6. #6
    Registered User
    Join Date
    03-10-2006
    Posts
    3

    Re: Need to find a string of values on a cell and if found then write on colum

    Hello, no it never has the complete year just 73-13 for example

  7. #7
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Need to find a string of values on a cell and if found then write on colum

    See if this works for your data,
    First, to keep the formulas from getting too long, I extracted the beginning and ending dates in B and C
    in B1
    =IF(TRIM(MID(A1,SEARCH("-",A1)-2,2))+0>20, 1900+TRIM(MID(A1,SEARCH("-",A1)-2,2)), 2000+TRIM(MID(A1,SEARCH("-",A1)-2,2)))
    In C1
    =IF(TRIM(MID(A1,SEARCH("-",A1)+1,3))+0>20, 1900+TRIM(MID(A1,SEARCH("-",A1)+1,3)), 2000+TRIM(MID(A1,SEARCH("-",A1)+1,3)))
    Then in D1 copied to the right
    =IF($B$1+COLUMN(A1)>$C$1+1,"",$B$1+COLUMN(A1)-1)
    See example
    Attached Files Attached Files

+ 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