Excel with conditional logic to find last row containing 'X' -


i don't know if possible in excel or not. i'm needing way link subsequent rows previous rows (children parent).

for example, row 2 contains parent information denoted 'm' in column e.

if parent has 3 children, rows 3,4,5, they're going contain 's' or 'd' in column e.

if there's 's' or 'd' need fine last row searching has 'm' , grab value b column in row (which unique id parent) , insert column in rows 3,4 & 5 create relationship between 3 children , 1 parent. there cases there no children number of children, , far we've been assured next row "up" parent subsequent children rows.

sample data

so in above, because e3 , e4 d (daughter) of row 2, need take b2 (uid) , put in f3 , f4. since next row m (parent) f5 blank. row 6 child of row 5, b5 , copy f6.

column b formula of first 3 letters of first name , dob formatted yyyymmdd , isn't necessary (but stored) child rows. hope clarifies!

here solution seems work: following formula written in e4 (entered array formula, i.e. ctrl-shift-enter on pc or cmd-shift-enter on mac), copied down needed. requires there sufficient space above (because "up 3 above row", needs valid row).

=if(not(e4="m"),index(b$1:b3,max((e1:e3="m")*row(e1:e3)))," ") 

explanation:

=if(not(e4="m")    - check not "parent" (i.e. need lookup) max((e1:e3="m")*row(e1:e3)))  - see cell has m. (e1:e3) produces 0 or 1                               - multiply row number , array of 0 or row number                               - max of last row number m index(b$1:b3, number)         - find corresponding value in column b                               - note $ sign since row absolute row " "                           - empty space when there if false (i.e. parent) 

here how looked me:

enter image description here


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

jsf - How to ajax update an item in the footer of a PrimeFaces dataTable? -

django - CSRF verification failed. Request aborted. CSRF cookie not set -