Returning Cell Value to Different Cell Based on Criteria

Cat129

Board Regular
Joined
Oct 20, 2012
Messages
96
I'm not sure how to explain what I need so hopefully the cells below explain. I have created some dummy data similar to what I need.

I'm trying to create a formula to go into the parent column (G) that will return the value from the part number column (B) of the parent above. All parents are a level 5. I have completed Column G to show you what I would like the end result to be

Any help would be really appreciated as I have been trying with index match using the level (Column D) as a reference and nothing I try works.

The solution can be in VB or a regular formula as this is an automated sheet which will all be coded eventually.

Thank You
Cat

[TABLE="class: grid, width: 500, align: left"]
<tbody>[TR]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[TD]E[/TD]
[TD]F[/TD]
[TD]G[/TD]
[/TR]
[TR]
[TD]Part Number[/TD]
[TD]Revision[/TD]
[TD]Level[/TD]
[TD]Qty[/TD]
[TD]Description[/TD]
[TD]Parent[/TD]
[/TR]
[TR]
[TD]Parent 1[/TD]
[TD]1[/TD]
[TD]5[/TD]
[TD]1[/TD]
[TD]Assembly[/TD]
[TD]Parent 1[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]2[/TD]
[TD]6[/TD]
[TD]1[/TD]
[TD]Part of Above[/TD]
[TD]Parent 1[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]1[/TD]
[TD]6[/TD]
[TD]2[/TD]
[TD]Assembly[/TD]
[TD]Parent 1[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]2[/TD]
[TD]7[/TD]
[TD]1[/TD]
[TD]Part of Above[/TD]
[TD]Parent 1[/TD]
[/TR]
[TR]
[TD]Parent 2[/TD]
[TD]2[/TD]
[TD]5[/TD]
[TD]1[/TD]
[TD]Assembly[/TD]
[TD]Parent 2[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]1[/TD]
[TD]6[/TD]
[TD]4[/TD]
[TD]Part of Above[/TD]
[TD]Parent 2[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]1[/TD]
[TD]6[/TD]
[TD]8[/TD]
[TD]Part of Above[/TD]
[TD]Parent 2[/TD]
[/TR]
[TR]
[TD]Parent 3[/TD]
[TD]1[/TD]
[TD]5[/TD]
[TD]1[/TD]
[TD]Assembly[/TD]
[TD]Parent 3[/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD]1[/TD]
[TD]6[/TD]
[TD]2[/TD]
[TD]Part of Above[/TD]
[TD]Parent 3[/TD]
[/TR]
[TR]
[TD]7[/TD]
[TD]1[/TD]
[TD]6[/TD]
[TD]4[/TD]
[TD]Part of Above[/TD]
[TD]Parent 3[/TD]
[/TR]
</tbody>[/TABLE]
 
Last edited:

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
Put this formula in cell G2 and copy down...

=IF(D2=5,B2,G1)

Hey Rick, Thanks for the response, unfortunately I dont think this will work. What happens when I get to D6 or D9? The formula would then be providing the wrong parent.

In the actual data parents have between 1 and over 300 child components within them, the amount of children also changes with each update so the formula would need to be dynamic
 
Last edited:
Upvote 0
Hey, Sorry. Was being thick. Yes this does work. I was trying to over complicate things.

Thank You for your help
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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