I'm trying to figure out a way how to fill blank cells in a row with previous existing data. I have an array of data with a customer ID-key I'd need to copy to some lines that don't automatically have the key ID due to gaps in source data.
Here's the situation. Gaps in data in Columns A:
Column A | Column B |
---|---|
Cell 1 | Cell 2 |
Cell 4 | |
Cell 6 | |
Cell 7 | Cell 8 |
Cell 10 | |
Cell 12 |
This question comes in two parts. See the wished solution I tried to create below.
use:
=ARRAYFORMULA(IF(B2:B="",, VLOOKUP(ROW(A2:A), IF(A2:A<>"", {ROW(A2:A), A2:A}), 2, 1)))
=ARRAYFORMULA(IF(B2:B="";; VLOOKUP(ROW(A2:A); IF(A2:A<>""; {ROW(A2:A)\ A2:A}); 2; 1)))
or:
=SCAN(; A2:INDEX(A:A; MAX(ROW(B:B)*(B:B<>""))); LAMBDA(a; b; IF(b=""; a; b)))