Finding next assembly in a Indentured PL
Finding next assembly in a Indentured PL
(OP)
I apologize if this is confusing but try and bear with me.
I have a Indentured PL in the following format...
x y z
1 0 A1 -
2 1 B1 A1
3 1 B2 A1
4 2 C1 B2
5 3 D1 C1
6 2 C2 B2
7 2 C3 B2
8 1 B3 A1
9 2 CC1 B3
The numbers on the left are line item numbers.
Column x is "indenture level"
Cloumn y is "part number"
Column z is non-existent(this is what I want to create), but will generate "next assembly"
So, B1, B2, B3 Next assemble into A1. C1, C2, C3 next assemble into B2... and so on.
I can easily identify the next assembly if the part is one cell below its parent using the following. ("none" was just a filler)
=IF(x2-1=x1,y1,"none") (error in row 1, not a big deal though)
I can also insert yet another IF statement in place of "none", but changeing the =x1 and y1 to its next higher cell... and do that numerous times until it finds the parent part.
However, my PLs are fairly large and would require 100's if not 1000's of IF statements within IF statements to track far enough up the PL to find the parent. A pretty sloppy solution.
Anyone have a "string" that would incrementally look one cell up until it finds a true condition?
The answer might be pretty trivial but Im pretty inexperienced at this.
Thanks in advance.
I have a Indentured PL in the following format...
x y z
1 0 A1 -
2 1 B1 A1
3 1 B2 A1
4 2 C1 B2
5 3 D1 C1
6 2 C2 B2
7 2 C3 B2
8 1 B3 A1
9 2 CC1 B3
The numbers on the left are line item numbers.
Column x is "indenture level"
Cloumn y is "part number"
Column z is non-existent(this is what I want to create), but will generate "next assembly"
So, B1, B2, B3 Next assemble into A1. C1, C2, C3 next assemble into B2... and so on.
I can easily identify the next assembly if the part is one cell below its parent using the following. ("none" was just a filler)
=IF(x2-1=x1,y1,"none") (error in row 1, not a big deal though)
I can also insert yet another IF statement in place of "none", but changeing the =x1 and y1 to its next higher cell... and do that numerous times until it finds the parent part.
However, my PLs are fairly large and would require 100's if not 1000's of IF statements within IF statements to track far enough up the PL to find the parent. A pretty sloppy solution.
Anyone have a "string" that would incrementally look one cell up until it finds a true condition?
The answer might be pretty trivial but Im pretty inexperienced at this.
Thanks in advance.





RE: Finding next assembly in a Indentured PL
This doesn't give you exactly what you asked for, but it should get you thinking.
CODE
1 0 A1 -
2 1 B1 A1 1
3 1 B2 - 0
4 2 C1 B2 1
5 3 D1 C1 1
6 2 C2 - 0
7 2 C3 - 0
8 1 B3 - 0
9 2 CC1 B3 1
The formula in cell helper2 is =IF(B3=B2+1,1,0)
The formula in cell z2 is =IF(E3=1,C2,"-")
Copy both down
RE: Finding next assembly in a Indentured PL
=INDEX(C3:$C$10,MATCH(B2-1,B3:$B$10,0))
and copy it down.
The point is that you cannot easily use a lookup function when the list is not ordered (like your column x), and if you use exact match (like my formula), then you will find the first occurrence that matches exactly - so item 4 will give B1 as a parent, not B2. That is why I had to reverse the list order.
Cheers,
Joerd
Please see FAQ731-376 for tips on how to make the best use of Eng-Tips.
RE: Finding next assembly in a Indentured PL
If you are only viewing it you can use the autofilter capability in Excel. Select all your data <Ctrl-A> and then click <Data><Filter><AutoFilter>. You'll see a little arrow at the top of the columns. Select the arrow on column B and you'll be able to select the level you want to see. Here is an example for level 1:
2 1 B1 A1
3 1 B2 A1
8 1 B3 A1