将列值从1更改为0

时间:2020-08-12 09:03:33

标签: arrays if-statement google-sheets google-sheets-formula array-formulas

我有一个1和0的列,我想改为相反。

|This   |Should be|
| 0     |1        |
| 1     |0        |
| 0     |1        |
| 1     |0        |
| 0     |1        |

我试图做=ARRAYFORMULA(SUBSTITUTE(A2:A,"0","1","")) 但这会将所有值更改为0,如果我执行Replace函数:(

有什么建议吗?

预先感谢

2 个答案:

答案 0 :(得分:2)

使用:

=INDEX(IF(A1:A="",,IF(A1:A*1=1, 0, 1)))

enter image description here

或:

=INDEX(IF(A1:A="",,N(A1:A*1=0)))

enter image description here

答案 1 :(得分:1)

尝试:

=-A1+1

enter image description here

我是在Excel上完成的,但它应该可以在Google表格上完美运行。

相关问题