'Moving 1 column into several columns based on an empty row

I'm trying to tidy up a spreadsheet from Google Sheets, essentially I only have two columns (date and value) but 3 different sets of data (separated by an empty row). I want to be able to grab everything after (in between) each empty row and paste it to the corresponding column. For example:

1 26
2 12
3 50
(empty row)
1 23
2 21
3 25
(empty row)
1 23
2 29
3 78

And I'd want it to be like this:

1 26 1 23 1 23
2 12 2 21 2 29
3 50 3 25 3 78

I've found some functions for detecting empty rows but wasn't sure where to go from there, sorry I'm a novice at Excel/Google Sheets. Any help would be greatly appreciated! TIA!

Here is a link to my sample spreadsheet (tab 1 is the sample data, tab 2 is what I'm trying to achieve)

https://docs.google.com/spreadsheets/d/1sp0Vk-_8T4bMcg-m0cGKq2ZvpLcJd9Y5jQS4Q8RD0Wo/edit?usp=sharing



Solution 1:[1]

use:

=ARRAYFORMULA(SPLIT(FLATTEN(QUERY(SPLIT(FLATTEN(SPLIT(QUERY(
 REGEXREPLACE(SUBSTITUTE(FLATTEN(QUERY(TRANSPOSE({
 IF(A1:A15="", "×", A1:A15), B1:B15}),,9^9)), 
 " ", "¤"), "¤$", ),,9^9), "×")), " "),,9^9)), " ¤"))

enter image description here

Solution 2:[2]

Formula:

=arrayformula(split(transpose(split(join(",", flatten(
 query(transpose(split(flatten(split(regexreplace(join("×", A1:A11&","&B1:B11), "×,×", "?"), "?")), "×")), 
 "select Col1, Col2, Col3, '×' label '×' ''", 0))), "×")), ","))

Output:

enter image description here

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 player0
Solution 2 ASyntuBU