Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Finding next assembly in a Indentured PL

Status
Not open for further replies.

JRW261

Mechanical
Feb 26, 2004
41
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.
 
Replies continue below

Recommended for you

You just need a helper column.

This doesn't give you exactly what you asked for, but it should get you thinking.

Code:
	x	y	z	helper
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
 
It would be a lot easier if your list is "upside down" which you might do by sorting on column A in descending order. Then, you can use the following formula in cell D2:
[tt]=INDEX(C3:$C$10,MATCH(B2-1,B3:$B$10,0))[/tt]
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.
 
Are you just trying to view the data by level or are you processing the data?

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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor