Objective: Write an array formula inside a column that outputs the nearest uppermost-parallel value from other column under the condition that a different column is set to a specific value.
See sheet and image below for example inputs and outputs. If the image fails to open, it is also inside the Sheet in "Image" tab.
You may try:
={"formula_";index(if((B5:B="Parent")+(B5:B=""),,scan(,A5:A,lambda(a,c,if(c="",a,c)))))}