如何自动填充列,直到达到一个新值,然后使用该值进行自动填充

时间:2021-02-03 21:27:19

I was wondering how can I autofill a column with a certain value until it reaches a new value in the same column, and then autofill with that?

我想知道如何用某个值自动填充一个列,直到它在同一列中达到一个新值,然后再用这个值进行自动填充?

I tried using Excel, but I don't know how. I can also use unix commands as well if there is a method for doing so (I just couldn't figure one out).

我试过用Excel,但我不知道怎么用。如果有方法的话,我也可以使用unix命令(我就是想不出来)。

Example - How can I turn this:

例子-我该如何改变:

12345   83492   A
28397   18723
20983   39847   
98237   28394   B
09477   34566   
03940   76382   C
39348   38495

Into this:

到这个:

12345   83492   A
28397   18723   A
20983   39847   A
98237   28394   B
09477   34566   B
03940   76382   C
39348   38495   C

Any help would be greatly appreciated!

如有任何帮助,我们将不胜感激!

EDIT - If you have a way of doing it in MySQL, I can do that as well

编辑-如果你在MySQL中有办法,我也可以这么做。

2 个解决方案

#1


7  

The easiest way I know is to do it via a formula in the column directly to the right.

我知道的最简单的方法是通过右边的列中的公式来做。

So for example, you wwuld have:

例如,你可能有

COL A:  COL B:   COL C:    COL D:
12345   83492    A         =C1
28397   18723              =IF(C2="",D1,C2)
20983   39847   
98237   28394    B
09477   34566   
03940   76382    C
39348   38495

Then drag the formula in D2 all the way down, then you can copy/paste values.

然后在D2中拖拽公式,然后你可以复制/粘贴值。

#2


1  

If you are not interested in VBA / Formula. Then, you can try below simple steps:

如果你对VBA /公式不感兴趣。然后,你可以尝试以下简单的步骤:

  1. Select the range. For Example, C1:C7
  2. 选择范围。例如,C1:C7
  3. Press Keyboard function key F5. A dialogue box appears (Go To)
  4. 按键盘功能键F5。对话框出现(转到)
  5. Click button 'Special'
  6. 点击按钮“特殊”
  7. From seen options (Radio button) select 'Blanks' and click 'OK'
  8. 从“可见选项”(单选按钮)中选择“空白”,然后点击“确定”
  9. Press Keyboard Key = (equal symbol) and Press Arrow-Up Key once.
  10. 按键盘键=(等于符号)并按下箭头键一次。
  11. Then, Press Keyboard Key CTRL+Enter together to see results
  12. 然后按键盘键CTRL+Enter键查看结果。

#1


7  

The easiest way I know is to do it via a formula in the column directly to the right.

我知道的最简单的方法是通过右边的列中的公式来做。

So for example, you wwuld have:

例如,你可能有

COL A:  COL B:   COL C:    COL D:
12345   83492    A         =C1
28397   18723              =IF(C2="",D1,C2)
20983   39847   
98237   28394    B
09477   34566   
03940   76382    C
39348   38495

Then drag the formula in D2 all the way down, then you can copy/paste values.

然后在D2中拖拽公式,然后你可以复制/粘贴值。

#2


1  

If you are not interested in VBA / Formula. Then, you can try below simple steps:

如果你对VBA /公式不感兴趣。然后,你可以尝试以下简单的步骤:

  1. Select the range. For Example, C1:C7
  2. 选择范围。例如,C1:C7
  3. Press Keyboard function key F5. A dialogue box appears (Go To)
  4. 按键盘功能键F5。对话框出现(转到)
  5. Click button 'Special'
  6. 点击按钮“特殊”
  7. From seen options (Radio button) select 'Blanks' and click 'OK'
  8. 从“可见选项”(单选按钮)中选择“空白”,然后点击“确定”
  9. Press Keyboard Key = (equal symbol) and Press Arrow-Up Key once.
  10. 按键盘键=(等于符号)并按下箭头键一次。
  11. Then, Press Keyboard Key CTRL+Enter together to see results
  12. 然后按键盘键CTRL+Enter键查看结果。