+ Reply to Thread
Results 1 to 20 of 20

Extract Year & Week from Product uneven Serial Number

  1. #1
    Registered User
    Join Date
    04-29-2015
    Location
    Mumbai
    MS-Off Ver
    2007
    Posts
    54

    Extract Year & Week from Product uneven Serial Number

    Hi,
    I need to extract year & week from list of serial numbers starting with S8H, SB, SCN, SE, SEN, SLN. After the mentioned Series..... Next 2 digits are mfg. year and next 2 digits are week of the year. e.g. S8H1323F15959.... S8H is series, 13 = year (2013) , 23=week of year (June). Please help with formula to extract year & week from uneven series codes.
    File attached.
    Thanks.
    Attached Files Attached Files

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,936

    Re: Extract Year & Week from Product uneven Serial Number

    Not sure where you want to put this, bit this will pull the year...
    =2000+MID(A4,IF(ISNUMBER(--MID(A4,3,1)),3,4),2)
    and this will pull the week...
    =--MID(A4,IF(ISNUMBER(--MID(A4,3,1)),5,6),2)
    both copied down as needed
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,602

    Re: Extract Year & Week from Product uneven Serial Number

    Try this:

    Formula: copy to clipboard
    Please Login or Register  to view this content.

  4. #4
    Forum Expert shukla.ankur281190's Avatar
    Join Date
    05-17-2014
    Location
    Lucknow, India
    MS-Off Ver
    Office 365
    Posts
    3,937

    Re: Extract Year & Week from Product uneven Serial Number

    Try

    B4=MID(A4,4,4)+0

    C4=CHOOSE(MONTH(DATE("20"&LEFT(MID(A4,4,4)+0,2)+0,1,(RIGHT(MID(A4,4,4)+0,2)+0)*7-2)-WEEKDAY(DATE((RIGHT(MID(A4,4,4)+0,2)+0),1,3))),"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")&"."&LEFT(MID(A4,4,4)+0,2)+0
    If I helped, Don't forget to add reputation (click on the little star ★ at bottom of this post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)

  5. #5
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,936

    Re: Extract Year & Week from Product uneven Serial Number

    zbor, nice one

  6. #6
    Registered User
    Join Date
    04-29-2015
    Location
    Mumbai
    MS-Off Ver
    2007
    Posts
    54

    Re: Extract Year & Week from Product uneven Serial Number

    Hi friends, thanks for your quick help but its half way done. My series are uneven i.e. S8H, SB2, SCN, SE2, SEN, SLN, SUA, S7A, E2, 7A, B2, PD, 5D, UD, S5D, BA, G1, GJ and so on..... so can we store these series somewhere in the worksheet or other worksheet in same file and link the series codes and then extract the year & date codes. Would appreciate your final resolution to this query. Thanks again for your time and help. Regards, Anil

  7. #7
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,914

    Re: Extract Year & Week from Product uneven Serial Number

    SB21406001998
    From the above which part is Year and which part is Week Number
    Samba

    Say thanks to those who have helped you by clicking Add Reputation star.

  8. #8
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,914

    Re: Extract Year & Week from Product uneven Serial Number

    for S8H there are 3 Year/Wk - 1323,1339 and 1347 in this case how to show the result

  9. #9
    Registered User
    Join Date
    04-29-2015
    Location
    Mumbai
    MS-Off Ver
    2007
    Posts
    54

    Re: Extract Year & Week from Product uneven Serial Number

    Dear Sir,
    Against below mentioned series, next 2 digit is year and other next 2 digit is week of year:
    S8H, SB2, SCN, SE2, SEN, SLN, SUA, S7A, E2, 7A, B2, PD, 5D, UD, S5D, BA, G1, GJ
    e.g.
    SB21406001998 : Series starts with SB2 & Digit 1406 where 14 is year 2014 and 06 is week of year 2014 (Feb)
    S8H1339F10034 : Series starts with S8H & Digit 1339 where 13 is year 2013 and 39 is week of year 2013 (Sep)
    SCN1310KD1823: Series starts with SCN & Digit 1310 where 13 is year 2013 and 10 is week of year 2013 (Mar)
    SE21333000038 : Series starts with SE2 & Digit 1333 where 13 is year 2013 and 33 is week of year 2013 (Aug)
    SEN1307GD1844: Series starts with SEN & Digit 1307 where 13 is year 2013 and 07 is week of year 2013 (Feb)
    .... and similalry my other series begins with codes SLN, SUA, S7A, E2, 7A, B2, PD, 5D, UD, S5D, BA, G1, GJ .... rest 4 digits followed are yyww (year & week of that year).
    Hope I have clarified my query correctly. Thanks for your time.

  10. #10
    Forum Expert shukla.ankur281190's Avatar
    Join Date
    05-17-2014
    Location
    Lucknow, India
    MS-Off Ver
    Office 365
    Posts
    3,937

    Re: Extract Year & Week from Product uneven Serial Number

    Please check the attached file.
    Attached Files Attached Files

  11. #11
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,914

    Re: Extract Year & Week from Product uneven Serial Number

    =DATE(2000+MID(A4,4,2),1,1)+(MID(A4,6,2)-1)*7-WEEKDAY(DATE(2000+MID(A4,4,2),1,1),2)+1
    Try this and copy towards down

  12. #12
    Registered User
    Join Date
    04-29-2015
    Location
    Mumbai
    MS-Off Ver
    2007
    Posts
    54

    Re: Extract Year & Week from Product uneven Serial Number

    MID command will work only where first 3 characters are fixed but in some series it starts after 2 digits.
    How you will define serial nos. G11449198768 and GJ1352157435 where MID starts from 3 and not 4.

  13. #13
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,914

    Re: Extract Year & Week from Product uneven Serial Number

    how can you bifurcate which series starts starts after 2 digits and which series starts starts after 3 digits

  14. #14
    Registered User
    Join Date
    04-29-2015
    Location
    Mumbai
    MS-Off Ver
    2007
    Posts
    54

    Re: Extract Year & Week from Product uneven Serial Number

    Hi friends, Anyone can give solution to my query.

  15. #15
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,914

    Re: Extract Year & Week from Product uneven Serial Number

    if you provide the digit number at which the year will start in one column then you will get the solution, otherwise it is difficult to say at which position the year will starts

  16. #16
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,914

    Re: Extract Year & Week from Product uneven Serial Number

    OK Then try
    B4
    Please Login or Register  to view this content.
    C4
    Please Login or Register  to view this content.
    AND COPY TOWARDS DOWN

  17. #17
    Registered User
    Join Date
    04-29-2015
    Location
    Mumbai
    MS-Off Ver
    2007
    Posts
    54

    Re: Extract Year & Week from Product uneven Serial Number

    Is there any method that we keep the series in vlookup and then co-relate the corresponding data.

  18. #18
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Extract Year & Week from Product uneven Serial Number

    Enter in H4 and fill down. Format as General
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Enter in I4 and fill down Format as mmm-yy
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    G
    H
    I
    3
    Series
    Year/Wk
    Mfg-Dt
    4
    S8H
    1323
    Jun-13
    5
    SB
    1406
    Feb-14
    6
    SCN
    1310
    Mar-13
    7
    SE
    1333
    Aug-13
    8
    SEN
    1307
    Feb-13
    9
    SLN
    1307
    Feb-13
    <---------If you like someone's answer, click the star to the left of one of their posts to give them a reputation point for that answer.
    Ron W

  19. #19
    Registered User
    Join Date
    04-29-2015
    Location
    Mumbai
    MS-Off Ver
    2007
    Posts
    54

    Thumbs up Re: Extract Year & Week from Product uneven Serial Number

    Hi, Though I am not fully satisfied with the answers but wherever MID is coming 3 instead of 4, I am doing the changes manually.
    Infact, I was looking for an automatic solution without doing any manual changes. However, thanks to you all for spending the time in studying my query. Regards,

  20. #20
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Extract Year & Week from Product uneven Serial Number

    I suspect that you have spaces in front of the data in the data in column A and maybe spaces after.
    If that is the case, this modification to the formula by zbor should fix the problem.
    Enter in B4 and fill down.
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    This should also fix problems in the small table G4:I9 that were caused by spaces if that was indeed the problem.

+ 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] Get the date of saturday in a week from a week number / year
    By JasperD in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-18-2015, 06:56 PM
  2. Match serial date (year) to number list 2000
    By JO505 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-20-2015, 02:08 PM
  3. [SOLVED] Serial Number generator by Day, two week cycle, pattern driven?
    By Speshul in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-14-2014, 12:52 PM
  4. [SOLVED] Incorrect Serial Number Returned for YEAR Function
    By greenmat in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 07-27-2012, 06:22 PM
  5. Sort by truncated year in serial number
    By MPICrusher in forum Excel General
    Replies: 3
    Last Post: 03-15-2011, 10:36 AM
  6. Year and week, adding zero before week number
    By randalino in forum Excel General
    Replies: 1
    Last Post: 06-23-2009, 10:34 AM
  7. [SOLVED] Calculating a Date Based on Year, Week Number and Day of the Week
    By amy in forum Tips and Tutorials
    Replies: 1
    Last Post: 08-23-2005, 11:42 AM

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