+ Reply to Thread
Results 1 to 11 of 11

How to create a date of manufacture and expiry date from a batch number

  1. #1
    Registered User
    Join Date
    12-29-2016
    Location
    London, England
    MS-Off Ver
    2013
    Posts
    3

    Question How to create a date of manufacture and expiry date from a batch number

    Hi all,

    I have a query regarding the title of this post. The company I work for use the batch number format : 17030201: where 17 = year, 03 = month, 02 = day & 01 = manufacturing run of the day.

    We then create batch certificates which require the date of manufacture (DOM) and an expiry date based on that DOM.

    I'm having trouble setting a formula in a cell that will essentially take the first six digits of the batch number and convert it to a date & then another cell which will have an expiry date taken from the cell with the DOM - a pre-determined expiry date is given to each batch for example: 4 weeks, 6 weeks, 8 weeks, 3 months 6 months & 12 months.

    Any help on this will be greatly appreciated.

    Thanks,

  2. #2
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,196

    Re: How to create a date of manufacture and expiry date from a batch number

    Attach a sample workbook.

    Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.

  3. #3
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: How to create a date of manufacture and expiry date from a batch number

    Will the date year always be in the 2000's?
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  4. #4
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,196

    Re: How to create a date of manufacture and expiry date from a batch number

    Date:

    A1=Batch Number

    =DATE(LEFT(A1,2)+2000,MID(A1,3,2),MID(A1,5,2))

    ADD expiry period as number of days to get Expiry date:

    28, 42, 56, 90 180, 365 (highlighted are "rounded" for 3 and 6 months)

  5. #5
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: How to create a date of manufacture and expiry date from a batch number

    Quote Originally Posted by JohnTopley View Post
    Attach a sample workbook.

    Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.
    Quote Originally Posted by JohnTopley View Post
    Date:

    A1=Batch Number

    =DATE(LEFT(A1,2)+2000,MID(A1,3,2),MID(A1,5,2))

    ADD expiry period as number of days to get Expiry date:

    28, 42, 56, 90 180, 365 (highlighted are "rounded" for 3 and 6 months)
    Why ask for a sample file if you're not going to wait to see said file?

  6. #6
    Registered User
    Join Date
    12-29-2016
    Location
    London, England
    MS-Off Ver
    2013
    Posts
    3

    Re: How to create a date of manufacture and expiry date from a batch number

    Thanks for the formula, that's worked a treat! We don't work in weeks or days for 3 months, 6 months and 12 months so if there's a different formula for adding on complete months at the end that would be great!

    Thanks again.

  7. #7
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: How to create a date of manufacture and expiry date from a batch number

    Quote Originally Posted by misterzim View Post
    if there's a different formula for adding on complete months at the end that would be great!
    Maybe this...

    =EDATE(DATE(LEFT(A1,2)+2000,MID(A1,3,2),MID(A1,5,2)),N)

    Where N is the number of months to add to the date.

  8. #8
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2016
    Posts
    5,910

    Re: How to create a date of manufacture and expiry date from a batch number

    Quote Originally Posted by misterzim View Post
    for 3 months,
    Or try this ...

    =EDATE(--TEXT(INT("20"&A1/100),"0000\/00\/00"),3)

  9. #9
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,196

    Re: How to create a date of manufacture and expiry date from a batch number

    @Tony,
    Why ask for a sample file if you're not going to wait to see said file?
    Imperfect that I am, I re-read the post and tried a solution:

    And why did YOU think any manufacturing date would not be in the 2000s ?? (given an expiry date of max of 1 year!): hardly likely to going back 17 years.

  10. #10
    Registered User
    Join Date
    12-29-2016
    Location
    London, England
    MS-Off Ver
    2013
    Posts
    3

    Re: How to create a date of manufacture and expiry date from a batch number

    Hello again.

    Having not been allowed to further my intentions, with regard to the original post, within my organisation, it has come to light that the expiry dates that excel produces from a DOM does not take into consideration months that don't have the same number of days in them.

    For example; a batch number of 18103101 would have been made on 31/10/18. If the expiry date of the product is 4 months, this should mean the expiry date is 28/02/19 but the formula above produces an expiry date of 03/03/19. My company currently uses a vlookup table where these instances are input manually but I am sure there must be an easier way?

    Can anyone help with this?

    Thanks.

    Actually, don't worry, the above formula (=EDATE(DATE(LEFT(A1,2)+2000,MID(A1,3,2),MID(A1,5,2)),N)) worked as it would have done 2 years ago! Sorry!
    Last edited by misterzim; 10-23-2018 at 05:22 AM. Reason: Don't require it

  11. #11
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2016
    Posts
    5,910

    Re: How to create a date of manufacture and expiry date from a batch number

    See formula in post #8

    =EDATE(--TEXT(INT(("20"&A1)/100),"0000\/00\/00"),4)

    the result is 28/2/2019

+ 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] Batch # along with Date of expiry
    By mhshiraz10 in forum Excel General
    Replies: 8
    Last Post: 07-25-2016, 03:47 AM
  2. autocalculate expiry date / expiry date colour warnings
    By kimbling1 in forum Excel General
    Replies: 8
    Last Post: 08-27-2014, 02:53 AM
  3. [SOLVED] Allocating a given date to a date range bucket: futures contract expiry
    By labogola in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-26-2013, 08:50 AM
  4. Creating a Date of Manufacture from a Lot Code String
    By GSPOwner1 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 12-09-2013, 05:40 PM
  5. Replies: 6
    Last Post: 11-30-2013, 12:15 AM
  6. [SOLVED] How do I create an expiry date (bomb) for my spreadsheet?
    By Sarahja in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-13-2013, 10:48 AM
  7. Replies: 5
    Last Post: 06-04-2012, 04:56 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