Automatic next lot number in excel log - excel

We are setting up a new way of logging our lot number and I was trying to find a way of doing it without having to manually enter each number.
The number is formatted as 161201-1 "1612" is the date code, "01" is the sub lot, "-1" is the line.
I want to make it so I only have to enter the first instance then can use a function that will add a line each time.
However there are only 4 lines per sub lot so each time the line reaches "-4" the next sub lot should be higher than the previous.
For example 161201-4 would be followed by 161202-1 (the date code stays constant until I type in a new lot).
I can't figure out what I would do for this kind of function.

Put every element of lot number in separate columns and than put it back together with "CONCATENATE" function. I did a sample for you and left the formulas as text in the last row.

Related

Excel Formula Slow

is there anything i can do to further improve performance of this formula ?
=IF($A3<>"",IF(Jan!$E6<>"",LET(d_patt,IF(Jan!$E6<>"",VLOOKUP(Jan!$E6,SETTINGS!$A$12:$B$27,2,FALSE)&IF(Jan!$B6<>"",Jan!$B6,0)&IF(Jan!$C6<>"",Jan!$C6,0)&IF(Jan!$D6<>"",Jan!$D6,0),""),"ROT"&IF(LEN(Teams!$BHR4)>0,MID(Teams!$BHR4,MOD(NETWORKDAYS.INTL(Teams!$C4,I$2,"0000000")-1,LEN(Teams!$BHR4)/3)*3+1,3),"000")&IF(LEFT(d_patt,3)="OVT",d_patt,"OVT000")&IF(LEFT(d_patt,3)="SSI",d_patt,"SSI000")&IF(LEFT(d_patt,3)="SSO",d_patt,"SSO000")&IF(LEFT(d_patt,3)="SDS",d_patt,"SDS000")&IF(LEFT(d_patt,3)="HOL",d_patt,"HOL000")&IF(LEFT(d_patt,3)="LID",d_patt,"LID000")&IF(LEFT(d_patt,3)="UNP",d_patt,"UNP000")&IF(LEFT(d_patt,3)="FLD",d_patt,"FLD000")&IF(LEFT(d_patt,3)="MAT",d_patt,"MAT000")&IF(LEFT(d_patt,3)="LIS",d_patt,"LIS000")&IF(LEFT(d_patt,3)="CBR",d_patt,"CBR000")&IF(LEFT(d_patt,3)="ABS",d_patt,"ABS000")),"ROT"&IF(LEN(Teams!$BHR4)>0,MID(Teams!$BHR4,MOD(NETWORKDAYS.INTL(Teams!$C4,I$2,"0000000")-1,LEN(Teams!$BHR4)/3)*3+1,3),"000")&"OVT000SSI000SSO000SDS000HOL000LID000UNP000FLD000MAT000LIS000CBR000ABS000"),"")
i have this on a sheet for each day of the year x 400 people so 146k+ times. this is therefor taken up 80% of the sheet load time.
The sheet basically gets shift patters from Teams, check if there is any holidays, overtime etc from the relevant month tab and relevant cell for the day, and then will generate a code like below.
ROT080OVT000SSI000SSO000SDS234HOL000LID000UNP000FLD000MAT000LIS000CBR000ABS000
i have so far managed to make this faster by using the LET function, but not show if its possible to make any further improvements.
if you need an example file i can send this or upload somewhere, not sure if that is possible via stackoverflow or a preferred site to upload to.
Thanks
The following is a shortened version of your formula to reduce the complexity of computations.
Instead of building the 'OVT000SSI000...' string one piece after another while always checking if the first 3 characters of 'd_patt' match the current piece, we can set the whole string with '000's as default and only replace the section that matches 'd_patt' (see highlighted elements in screenshot below)
Which results in the full formula:
=IF(LEN($A3)>0,"ROT"&IF(LEN(Teams!$BHR4)>0,MID(Teams!$BHR4,MOD(NETWORKDAYS.INTL(Teams!$C4,I$2,"0000000")-1,LEN(Teams!$BHR4)/3)*3+1,3),"000")&LET(default,"OVT000SSI000SSO000SDS000HOL000LID000UNP000FLD000MAT000LIS000CBR000ABS000",d_patt,VLOOKUP(Jan!$E6,SETTINGS!$A$12:$B$27,2,FALSE)&IF(LEN(Jan!$B6)>0,Jan!$B6,0)&IF(LEN(Jan!$C6)>0,Jan!$C6,0)&IF(LEN(Jan!$D6)>0,Jan!$D6,0),IF(LEN(d_patt)>0,REPLACE(default,SEARCH(LEFT(d_patt,3),default),6,d_patt),default)),“”)
If $B6, $C6 and $D6 can only be either empty or a numerical number, in other words, if they are never a letter or special character, the 'd_patt' function can be further shortened as follows:
Which results in the full formula:
=IF(LEN($A3)>0,"ROT"&IF(LEN(Teams!$BHR4)>0,MID(Teams!$BHR4,MOD(NETWORKDAYS.INTL(Teams!$C4,I$2,"0000000")-1,LEN(Teams!$BHR4)/3)*3+1,3),"000")&LET(default,"OVT000SSI000SSO000SDS000HOL000LID000UNP000FLD000MAT000LIS000CBR000ABS000",d_patt,VLOOKUP(Jan!$E6,SETTINGS!$A$12:$B$27,2,FALSE)&(Jan!$B6+0)&(Jan!$C6+0)&(Jan!$D6+0),IF(LEN(d_patt)>0,REPLACE(default,SEARCH(LEFT(d_patt,3),default),6,d_patt),default)),“”)

Index with double Match returns incorrect closest values

I have an planning exported to Excel which looks like the following (tab ' Data'):
Each production line has a number of people working on it. Now is my goal to show how many people are working on a line per minute. We plan per product group, and several product groups combined form waht a line has to do per minute.
To get the production per minute I created the following (tab 'Conversie'):
=INDEX(Data!$H$2:$H$157;MATCH($N$1&A4;Data!$B$2:$B$157&Data!$C$2:$C$157;1))
In the example it works correct. However, the formula doesn't seem to always return the correct "Artikelomschrijving"(H) every time. I get incorrect return values when I extend this formula to other product groups.
I read that the data needs to be sorted ascending cause I use match_type 1. When I do that I get the right returns for some product groups, but the given example suddenly returns incorrect values.
I can't sort both column C and A in ascending order for the formulas to always return correct items. Can you help me to get past this hurdle?
After a little bit of google translate work, if I'm understanding your question correctly, you need to find the "Item Description" (H) of the record where the "Line" (B) = the value in N1 and the time is between the start and end times.
This is an array formula, you have to confirm it with Ctrl+Shift+Enter
=INDEX(Data!$H$2:$H$157,MATCH(1,(Data!$B$2:$B$157=$N$1)*(Data!$C$2:$C$157<$A2)*(Data!$D$2:$D$157>=$A2),0))
OR with semicolon syntax:
=INDEX(Data!$H$2:$H$157;MATCH(1;(Data!$B$2:$B$157=$N$1)*(Data!$C$2:$C$157<$A2)*(Data!$D$2:$D$157>=$A2);0))
I found the solution, thank you for pointing me in the right direction Valon Miller. This is the formula I fixed it with:
=ALS.FOUT(INDEX(Data!$H$2:$H$154;MATCH(1;(Conversie!L$1=Data!$B$2:$B$154)*((Conversie!$A32>=Data!$C$2:$C$154)*(Conversie!$A32<=Data!$D$2:$D$154));0));"")

Is there a quick way for excel to identify and remove duplicate series from a cell such as this?

Is there a built in function, or a simple UDF that can identify the pattern in the information below and remove the duplicates?
Assume the following is all within a single excel cell:
80154, 80299, 80299, 82055, 82145, 82205, 82520, 82570, 83840, 83925,
83925, 83986, 83992, 84315, 80154, 80299, 80299, 82055, 82145, 82205,
82520, 82570, 83840, 83925, 83925, 83986, 83992, 84315
There are two sets of data (starts with 80154 ends with 84315). I want to end up with only one set, but I want to do it to 50,000 lines. The final output should be just the BOLD text. Also, sometimes the data repeats itself 3 times, again, I just want the unique set of data.
NOTE: I can't just remove duplicates, because sometimes there will be duplicates in the set that I need to capture in the final output. For example, (A,A,B,C,A,A,B,C) needs to be reduced to (A,A,B,C).
This finds where the first 20% is repeated and cuts the string at that point.
IF it does not find a duplicate it will return the whole string.
=IFERROR(LEFT(A1,FIND(LEFT(A1,LEN(A1)/5),A1,2)-3),A1)
Play with the 5 till you find the proper length of string that will get you the correct answer on all your strings. The higher the number the smaller the string it compares.
Also if it is cutting off too much or not enough, like leaving the , at the end adjust the -3 up and down.

How to use "IF" code with multiple conditions?

I have 5 columns of data with around 50,000 rows. This is the ambulance response times to an incident. I am trying to figure out the total number of incidents as multiple ambulances respond to a single incident. The 'IF' function has been useful upto a certain extent where the multiple ambulances reached at the same time but when it is not at the same time, it considers it as a different incident. I would like to add a buffer of 20 minutes but I am not able to figure out how to incorporate that. The second problem is with the incident number. The incidents 2014-014374-006, 2014-014374-009 are the same, just the ending numbers are different. How do I differentiate? Can I do it in excel or other platforms?
http://imgur.com/a/30VHl
To return the incident number, use a formula like this: "=IF(ISERROR(SEARCH("-",D5,SEARCH("-",D5)+1)),D5,LEFT(D5,SEARCH("-",D5,SEARCH("-",D5)+1)-1))" where D5 is the cell with your incident number.
What this formula does is it first creates an if statement that will allow you to determine if the incident has the second dash or if it doesnt. If it doesn't, then it will return the value in the cell. If it does, it will return the text to the left of that dash. The search function looks for a substring, and by nesting a search and adding "1" to the value of the first search, we are looking for the substring that comes after the first one is found.
It is a rather confusing formula the first time you use it, but it works like a charm once you understand it.
I will see if I can figure the dates out. That might be more difficult. If you can simply use the incident number for this, you will likely have an easier time.

Excel small mistake in function

I'm having a small problem with my formula in excel. I got a long list with IDs from different people numbered from 1 to 20535 for which I want to calculate the portfolio return. One ID has multiple lines so the ID is repeated over multiple lines depending on their number of investments.
This is the formula (it's working perfectly except for the bold)
=IF(B3=1;SUMIF($B$2:$B$357553;V3;$D$2:$D$357553);B4=B3+1)+IF(B3=1;SUMIF($G$2:$G$187396;V3;$I$2:$I$187396);B4=B3+1)+IF(B3=1;SUMIF($M$2:$M$544950;V3;$O$2:$O$544950);B4=B3+1)+IF(B3=1;SUMIF($R$2:$R$131523;V3;$T$2:$T$131523);B4=B3+1)
The only mistake is the part in bold. Once I get to the second person (so the second ID) it stops as the condition is not met anymore. How can I make it run past the first person? So untill ID 20535.
Thanks in advance!
Since you just want the TRUE part of the IF each time, just remove the IF and use the SUMIFs:
=SUMIF($B$2:$B$357553;V2;$D$2:$D$357553)+SUMIF($G$2:$G$187396;V2;$I$2:$I$187396‌​)+SUMIF($M$2:$M$544950;V2;$O$2:$O$544950)+SUMIF($R$2:$R$131523;V2;$T$2:$T$131523)‌​
Put the above in row 2 and copy down. That should do it.

Resources