I have a dataset which looks like the following:
A | B | C | D | E |
---|---|---|---|---|
1 | 4 | 5 | ||
2 | 3 | 6 | ||
1 | 3 |
I need to create a column which concatenates the cells in each row from the first cell with a value, to the last cell with a value, even if there are blanks in the middle. These need to be separated by a semi-colon. So the output for the first row would be 1; ;4;5
. Second row would be 2;3; ;6
. Third row would be 1; ; ; ;3
.
As it stands I have managed to add a couple of formulas which identify the start and end column references within the range for each row (i.e. first row starts column 1, ends column 4).
The formula for finding first non-blank cell ref in row:
={MATCH(FALSE(ISBLANK(H6:AB6),0)}
The formula for finding last non-blank cell ref in row:
=AGGREGATE(14,6,(COLUMN(H6:AB6)-COLUMN(H6+1)/(H6:AB6<>""),1)
I am struggling with how to get the formula to use the starting column number for that row and pull back subsequent cell values with the ; separator until it gets to and includes the last column reference number.