Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to autofill a column until a new value is reached, then autofill using that value

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).

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

like image 445
Raymosrunerx Avatar asked Jan 15 '23 23:01

Raymosrunerx


2 Answers

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.

like image 81
John Bustos Avatar answered Jan 17 '23 13:01

John Bustos


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

  1. Select the range. For Example, C1:C7
  2. Press Keyboard function key F5. A dialogue box appears (Go To)
  3. Click button 'Special'
  4. From seen options (Radio button) select 'Blanks' and click 'OK'
  5. Press Keyboard Key = (equal symbol) and Press Arrow-Up Key once.
  6. Then, Press Keyboard Key CTRL+Enter together to see results
like image 20
beginnerv Avatar answered Jan 17 '23 11:01

beginnerv