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 | |
答案 0 :(得分:3)
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)
答案 1 :(得分:2)
In Excel
Even rows
=INDEX($A:$A,ROW()*2)
Odd Rows
=INDEX($A:$A,ROW()*2-1)