Hello,
I am looking for help with the following function. I used this function for a digital lot number book for 2017, but we are making some changes and I need to make a new book for 2018. The changes involve some leading zeroes, which are making my formula a bit more difficult. Here is the setup.
=LEFT(D6,4)&(MID(G5,5,3)+1)&"-"&"7"&LEFT(A6,3)
In cell D6 is where my product code will go. These are either 3 or 4 digits, there are 5 different product codes= TQA or TQBG are some examples.
In cell A6 I store the julain date as calcluated by excel when the user enters the date. For example if the user entered 1/1/17 the julain date would be displayed as 001. The left function at the end of the string simply tacks this julain date on the end of the lot number.
In cell G5 is the previous lot number. Note: to start the sheet I would manually enter the first lot number and allow the function to generate lot numbers for me for the rest of the sheet. G5 contains TQGB789-7006.
So if we follow along the first left function will pull over the product code which the analyst will enter into cell D6.
The mid function will pull and add one to the 3 digit lot number. From the above example 789 would becomes 790.
The last bit of the string adds in the "7" for the year and then tacks on the julian date.
So here is my changes and my questions. I am changing from the one digit year to a two digit year. From "7" to "18."
To account for the extra digit we are dropping the T from all of our product codes. So TQA becomes QA.
All of this is an easy fix for me, I have the left and right part of the formula all set. This year we are also resetting the lot numbers back to 001, which is where my issue comes up. Instead of starting on 789 for the year I am starting on 001. The leading zeroes are what is causing my issue. Normally I would use the left function to take the entire string, but in this case I can't due to the different length product codes.
Any help on this would be great, let me know if you need further clarification.
Bookmarks