Search code examples
arraysif-statementgoogle-sheetsgoogle-sheets-formulavlookup

Unavoidable merged Cells - Fill blank cells with previous non-blank cell in same column


I have a roster table for a sports facility that has been formatted and has a column of merged cells (for human readability). Unfortunately I cannot change the formatting to eliminate the merged cells - too many people use it and in any case I'd need to overhaul all the formulas everywhere.

The cells contain names and merge 4 rows of a single column. Formatted roster table w/ sample data

In a separate range I am trying to take this formatted info and put it into 1st normal form for analysis & graphing purposes. Since merged cells only contain the top-leftmost value, when trying to copy the column contents by formula (e.g. "=B14") it only shows the name in the top cell followed by 3 empty ones below.

I need to fill in the blank rows by copying the athlete names down. The other column formulas are working just fine.

For the life of me I can't figure it out. It has to be a formula and not apps script due to mobile use, and I've always been really bad with certain formulas and good with others. Usually I can make a guess at it, but this time I'm just lost.

Can someone point me in the right direction?


Solution

  • use:

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

    enter image description here