Initial layout
I am attempting to auto fill column C with type column B title, from the nth instance where column A = "D", and to automatically populate the value, until the next occurrence of A = "D", then use the next instance where column A = "D".
Desired output
Use XLOOKUP that searches from the bottom up and use dynamic ranges:
=XLOOKUP("D",$A$1:A2,$B$1:B2,"",0,-1)
Or if you want it to spill:
=SCAN("",ROW(A2:A13),LAMBDA(z,y,XLOOKUP("D",$A$1:INDEX(A:A,y),$B$1:INDEX(B:B,y),"",0,-1)))
Then there is the simply dragdown formula:
=IF(A2="D",B2,C1)