Short Answer
Use arrays in Google Sheets and SORT() function.
Example
To combine the non continuous ranges A1:D5, H1:K100, P1:S15, the following formula will return a 4 X 120 array sorted by the first column in ascending order.
=SORT({A1:D5;H1:K100;P1:S15},1,TRUE)
The first parameter also could be any function that returns an array like IMPORTFEED.
Remarks
- The URLs provided in example are not working because the YouTube Data API (v2) has been officially deprecated as of March 4, 2014.
- IMPORTJSON() was retired of the new Google Sheets.
References
I offer two versions, depending on whether blank cells should be kept. The basic idea is the same:
- Pick a character that is not contained in your table (e.g., an exotic Unicode character accessible via
CHAR
).
- Use it in the
JOIN
command for each of three columns.
- Concatenate the results, adding the character in between.
SPLIT
the concatenated string by the same character.
TRANSPOSE
the result.
For example:
=TRANSPOSE( SPLIT( JOIN(CHAR(57344),A1:A) &CHAR(57344)& JOIN(CHAR(57344),B1:B) &CHAR(57344)& JOIN(CHAR(57344),C1:C), CHAR(57344) ) )
where for joining/splitting, I picked the character CHAR(57344)
, which is designated for private use and therefore should not be present in any valid input.
The above formula removes blank entries, because this is what SPLIT
does. This may be convenient if your data does not have blanks: saves you the trouble of tracking where the last row of the data is. But other times, blanks should be preserved.
To preserve blanks, I follow the answer by Jacob Jan Tuinstra except that I used another private use Unicode instead of space (who knows, maybe you have some cells that contain just a space and you want to keep those). This involves two extra steps: after joining everything as before, I use SUBSTITUTE
to replace CHAR(57344)
by CHAR(57344)&CHAR(57345)
, then split as before, and replace CHAR(57345)
by empty string.
=TRANSPOSE( ARRAYFORMULA(SUBSTITUTE( SPLIT( SUBSTITUTE(...joins... , CHAR(57344),CHAR(57344)&CHAR(57345)), CHAR(57344) ), CHAR(57345), "")))
The full result looks like this (notice that now I specify where the last row of data is):
=TRANSPOSE( ARRAYFORMULA(SUBSTITUTE( SPLIT( SUBSTITUTE(JOIN(CHAR(57344),A1:A9) &CHAR(57344)& JOIN(CHAR(57344),B1:B9) &CHAR(57344)& JOIN(CHAR(57344),C1:C9), CHAR(57344),CHAR(57344)&CHAR(57345)), CHAR(57344) ), CHAR(57345), "" )))
One more caveat: strings in Google Sheets cannot exceed 50000 characters in length. If your data is too large for string-based approach to work, use a script (this one is a good place to start).
Best Answer
you need to separate them with
;
if you want to keep one header try:
if you want to go full dynamic try:
you can also use a query like: