According to @player0's answer and his comment about "query adds one empty space between each cell", you can use the ARRAYFORMULA
, SPLIT
, and SUBSTITUTE
functions to manipulate the output of the QUERY
function.
=ARRAYFORMULA(SPLIT(SUBSTITUTE(QUERY({G5;G10;G19;G27;G39;G46;G59}&"@@@@@",,9^9),"@@@@@ ",""),"@@@@@"))
By setting a unique possible (with lower chance to exists in your data) character, such as "@@@@@", and adding the space after it (e.g., "@@@@@ "), you can substitute for an empty value (e.g., ""). However, in the end, it will keep one "@@@@@" without space. To solve this, you can split it and get the first part only.
This formula will also achieve a SUBSTITUTE Limitation, however, it can sustain a little more than 50000 characters.