简体   繁体   English

Excel公式根据另一列值复制一列

[英]Excel formula to copy a column based on another column value

I have 3 excel columns like this, 我有3个这样的excel列,

Col_A     Col_B     Col_C
-----     -----     -----
Ross      Joey    
Rachel
Monica    Chandler
          Pheobe
Gunther   Janice
          Carol
Susan     Richard

I want the values to be copied in Column C in the following condition, 我希望在以下情况下将值复制到列C中,

  1. If Col_B has value, then Col_C should have the same value as Col_B (Regardless of Col_A has value or not). 如果Col_B具有值,则Col_C应该具有与Col_B相同的值(无论Col_A是否具有值)。
  2. If Col_B is Blank, then Col_C should have the same value as Col_A. 如果Col_B为Blank,则Col_C应该具有与Col_A相同的值。

So finally my Col_C will look like this, 所以最后我的Col_C看起来像这样,

Col_C
-----
Joey
Rachel
Chandler
Pheobe
Janice
Carol
Richard

Is there any excel formula using which I can achieve this? 是否有任何可以用来实现此目标的Excel公式?

The below will work if the empty cells are indeed empty 如果空白单元格确实为空,则以下内容将起作用

=IF(Col_B="",Col_A,Col_B)

The below if the 'empty' cells have a space (this crops up more often than you'd think!) 下面是“空”单元格是否有空格的情况(这种情况比您想象的要频繁发生!)

=IF(Col_B=" ",Col_A,Col_B)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM