Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Move even / odd rows to separate columns

I've a table like this:

   | A | B | C
---+---+---+---
 1 | Z |   |
 2 | 1 |   |
 3 | Y |   |
 4 | 2 |   |
 5 | X |   |

I am trying to transform it to move all even rows to column B and all odd rows to column C. I can use formula like =INDIRECT("A"&2*ROW()) for each single cell but is there a way to do this automatically for the whole column (only one formula in B1 and C1?

The result should be like:

   | A | B | C
---+---+---+---
 1 | Z | 1 | Z
 2 | 1 | 2 | Y
 3 | Y |   | X
 4 | 2 |   |
 5 | X |   |
like image 434
friedman Avatar asked Dec 05 '25 14:12

friedman


1 Answers

Google Sheets

Please try:

=FILTER(A:A,ISODD(ROW(A:A)))

and

=FILTER(A:A,ISEVEN(ROW(A:A)))


Please also try:

=QUERY(A:A,"select * skipping 2", 0)

and

=QUERY(A:A,"select * skipping 2 offset 1", 0)

like image 199
Max Makhrov Avatar answered Dec 09 '25 00:12

Max Makhrov