Google sheet array formula to allocate values to rows based on index in another column over blank rows

Viewed 128

I'm struggling to find a solution which should be quite simple

I have a sheet that lists the following: Column A - Index number (only allocated to the first line for each item) Column B - Description Column C - Detail breakdown of item in multiple rows Column D - Cost of the detail items

I need an array formula to allocate the index number to each of the detailed items based on the Index number in column A (basically populating the empty rows with the number above until the number is changed to the next number). Number are not necessarily sequential

I have tried various options with vlookup, indirect, etc in an array but don't know enough to solve it. The last formula I explored was

=arrayformula(if(A2:A="",vlookup(A2:A,A2:A,1),A2:A))

Herewith a link to the spreadsheet: https://docs.google.com/spreadsheets/d/1MOCrzrcMwFaTujHbJYXmxNVAW8LoqR0j0kadLrF85iA/edit?usp=sharing

1 Answers

use:

=ARRAYFORMULA(IF(C2:C="",, VLOOKUP(ROW(A2:A), IF(A2:A<>"", {ROW(A2:A), A2:A}), 2, 1)))

enter image description here

Related