How to populate the unit # based on the last max number in a range in excel?

lowestsky27

New Member
Joined
Oct 25, 2022
Messages
6
Office Version
  1. 365
Platform
  1. Windows
I tried creating a table to aid a manufacturing process. Where technicians perform some test and record the results. One of the column (unit #) auto populates based on other column entries of the table.

The unit # column helps keep track since a technician is supposed to test 14 units in a shift (4 different shifts - 1,2,3,4). The way I wrote the formula, it populates an "out of range" message when the unit being tested is not conforming to the standards and the tech needs to move on to the next unit. Leaving the "out of range" entry as is (this entry is needed for record keeping).

The table works as intended unless there are consecutive "out of range" units in the column. Then it goes back to unit# 1 (instead of unit#8 in case of this example)

1666703013219.png


Formula:

=IFERROR(IF(C16="","",IF(OR(AG16="Too Thick",AG16="Too Thin"),"Out of Range",IF(OR([@DATE]<>D15,C16<>C15),1,IF(OR(AG15="Too Thick",AG15="Too Thin"),IF([@DATE]=D14,AE14+1,1),AE15+1)))),"1")

What changes would you suggest I make to my formula? I tried MAXIFS at the end but got a !spill# error.
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
I don't want to assume what the whole formula is trying to accomplish, as the working in rows 14 through 16 confuses me a bit...but I'm not even one full coffee in today.

But what I can offer is, anytime you want to result in a Unit #, you'll want to include a MAX($AE$14:$AE14)+1. Making sure that the $AE14 is the referring to the row directly above the row in which the formula is populated. Another example, the formula in populated in cell AE26 would read MAX($AE$14:$AE25)+1

Then as you have a need to drag it down, it should grow correctly.

Also take a look at each time you are looking for your TRUE result to be "1", that would also cause your Unit #'s to start from the beginning. You'll want to use the same MAX formula as provided above.

Good luck!
 
Upvote 0
Hi & welcome to MrExcel.

How about
Excel Formula:
=IF(OR(AG14={"Too thick","Too Thin"}),"Out of range",MAXIFS(AE$13:AE13,C$14:C14,C14,D$14:D14,D14)+1)
 
Upvote 0
Solution
You're welcome & thanks for the feedback.
Hope you have been well Fluff! I came across another issue and haven't been able to fix it. If there are multiple out of ranges in the next shift that falls on the same date the numbers are not adding up correctly. I tried removing the date criteria from MAXIFS but it did not work. Any more ideas?
1667307176509.png



=IFERROR(IF(C33="","",IF(OR(AG33="Too Thick",AG33="Too Thin"),"Out of Range",IF(OR([@DATE]<>D32,C33<>C32),1,IF(OR(AG32="Too Thick",AG32="Too Thin"),IF([@DATE]=D31,AE31+1,1),AE32+1)))),IF(OR(AG33={"Too thick","Too Thin"}),"Out of range",MAXIFS(AE$13:AE32,C$14:C33,C33,D$14:D33,D33)+1))
 
Upvote 0
That is not the formula I suggested.
 
Upvote 0
In that case can you post some sample data.

MrExcel has a tool called “XL2BB” that lets you post samples of your data that will allow us to copy/paste it to our Excel spreadsheets, so we can work with the same copy of data that you are. Instructions on using this tool can be found here: XL2BB Add-in

Note that there is also a "Test Here” forum on this board. This is a place where you can test using this tool (or any other posting techniques that you want to test) before trying to use those tools in your actual posts.
 
Upvote 0
In that case can you post some sample data.

MrExcel has a tool called “XL2BB” that lets you post samples of your data that will allow us to copy/paste it to our Excel spreadsheets, so we can work with the same copy of data that you are. Instructions on using this tool can be found here: XL2BB Add-in

Note that there is also a "Test Here” forum on this board. This is a place where you can test using this tool (or any other posting techniques that you want to test) before trying to use those tools in your actual posts.
Thanks for the mini-sheet suggestion. Here is the sample data

Columbus modified testdropball_COL.xlsx
CDEFACADAEAFAG
11SHIFTDATELUX IDJob IDEyeBRKG CODELens #MeasuredResult
1248/26/20225248255269126L11.92 
1348/26/20225248255296138LOut of Range0.05Too Thin
14110/31/20226011779817353L2412.28Pass
15110/31/20226011779810704R8222.32Pass
16110/31/20226011779787314L1531.74Pass
17110/31/20226011779787314R15Out of Range1.57Too Thin
18110/31/20226011779792383R14Out of Range2.37Too Thick
19110/31/20226011779758905L2742.13Pass
20110/31/20226011779810512L2752.11Pass
21110/31/20226011779811087L3061.85Pass
22110/31/20226016889813865R2971.91Pass
23110/31/20226016889813865L2981.88Pass
24110/31/20226016889803756L2492.21Pass
25110/31/20226016889814480L27101.90Pass
26110/31/20226016889814000L14111.88Pass
27110/31/20226016889801319L27122.40Pass
28110/31/20226016889822871R15132.38Pass
29110/31/20226016889809476L82141.91Pass
30210/31/20226013139772136R3011.75Pass
31210/31/20226013139759044R24Out of Range2.20Too Thick
32210/31/20226013139759044L24Out of Range2.11Too Thick
33210/31/20226013139771544R24151.47Pass
34210/31/20226013139771544L24161.55Pass
35210/31/20226013139794444L24Out of Range2.54Too Thick
36210/31/20226013139753607L24172.06Pass
37210/31/20226013139798500L24181.69Pass
38210/31/20226013139788247L24191.73Pass
39210/31/20226013139795754L24Out of Range2.59Too Thick
40210/31/20226013139794437L24201.92Pass
41210/31/20226013139795107L15212.42Pass
42210/31/20226013139752453L82222.05Pass
43210/31/20226013139782970R15232.45Pass
44210/31/20226013139798400R32241.88Pass
45210/31/20226013139764675R24252.17Pass
46210/31/20226013139764675L24262.36Pass
47210/31/20226013139776024L92271.54Pass
48210/31/20226013139800602L24281.93Pass
49  
50  
51  
Drop Ball Sheet
Cell Formulas
RangeFormula
AG12:AG13,AG49:AG51,AG39,AG35,AG31:AG32,AG17:AG18AG12=IF([@Measured]<[@MIN],"Too Thin",IF([@Measured]>[@MAX],"Too Thick",""))
AE12:AE13AE12=IFERROR(IF(C12="","",IF(OR(AG12="Too Thick",AG12="Too Thin"),"Out of Range",IF(OR([@DATE]<>D11,C12<>C11),1,IF(OR(AG11="Too Thick",AG11="Too Thin"),IF([@DATE]=D10,AE10+1,1),AE11+1)))),IF(OR(AG12={"Too thick","Too Thin"}),"Out of range",MAXIFS(AE11:AE$13,C12:C$14,C12,D12:D$14,D12)+1))
AE14:AE51AE14=IFERROR(IF(C14="","",IF(OR(AG14="Too Thick",AG14="Too Thin"),"Out of Range",IF(OR([@DATE]<>D13,C14<>C13),1,IF(OR(AG13="Too Thick",AG13="Too Thin"),IF([@DATE]=D12,AE12+1,1),AE13+1)))),IF(OR(AG14={"Too thick","Too Thin"}),"Out of range",MAXIFS(AE$13:AE13,C$14:C14,C14,D$14:D14,D14)+1))
Cells with Conditional Formatting
CellConditionCell FormatStop If True
AG12:AG1999Cell Valuecontains "Fail"textNO
AG12:AG1999Cell Valuecontains "Too"textNO
AF12:AF1999Cellcontains a blank value textNO
AF12:AF1999Cell Valuenot between $H12 and $I12textNO
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,326
Members
452,635
Latest member
laura12345

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top