0

I go crazy so far...

I have an excel file with columns like below:

Value 1 | Value 2 | Addition 1 | Value 3 | Value 4 | Addition 2

The first two columns (Value 1, Value 2) are just values, the third column (Addition 1) is the addition of column 1 and column 2. The same goes for the columns number four and five (Value 3, Value 4), they are just values and the sixth column (Addition 2) is the addition of column four and five.

Now I have a CSV file that looks like that:

1;2;;4;5;

My goal now is to import the data from that CSV file to the excel sheet without overriding columns three and six. How is that possible?

I tried it like that: I open the CSV file in an editor and copy the content of it and paste it in the first column. Then I go to the register data and then click on "Text to columns", in that dialog i select the semikolon as a separator and then finish. But it overrides the values respectively my formula for the addition even tough there is no value in that column in the csv file.

What am I doing wrong?

  • You should write a vba to read the contents of the file, then get content and write to excel file. This link should help you https://stackoverflow.com/questions/11528694/read-parse-text-file-line-by-line-in-vba – ManhND Apr 02 '20 at 07:38

1 Answers1

0

I don't think you can instruct the copying process to ignore part of the original when pasting. Why not modify the pasted copy after the process is done?

  1. Ascertain the first and last row of your pasted copy, as well as the last column that will need a formula. I presume 2, 300 and column I.
  2. Type =A2+B2 in cell C2
  3. Select C2 and Press Copy or Ctl+C
  4. From the Ribbon's Home tab select Find & Select > GoTo
  5. In the dialog box's Reference field type C2:300,F2:F300,I2:I300 [etc]
  6. Press OK
  7. Press Enter

All your sum functions have been replaced.

Variatus
  • 14,293
  • 2
  • 14
  • 30