Ask Your Question

Do i need a macro to make a csv (two-values-per-line) multicolumn?

asked 2018-02-19 13:52:23 +0200

hrxv1 gravatar image

updated 2018-02-19 14:39:50 +0200

Lupp gravatar image

I have a large csv file with the following format of 2 fields per line :



Using Calc, I would like to have the second value as a column header so that column b would contain these rows - empty,40,empty,34,14,empty and column c would have only row 3 containing 12.

Thank you.

(Edited by @Lupp for better readability. Hopefully there wasn't every other row meant to be empty.)

edit retag flag offensive close merge delete


You missed "2 in A1, rest of column A empty".

Lupp gravatar imageLupp ( 2018-02-19 14:40:16 +0200 )edit

2 Answers

Sort by » oldest newest most voted

answered 2018-02-19 19:35:35 +0200

JohnSUN gravatar image

Without a macro, this is also not difficult. Add a line of headers, add a column of line numbers, create a pivot table, take the necessary cells and save as a new CSV file


edit flag offensive delete link more

answered 2018-02-19 17:31:03 +0200

Lupp gravatar image

There are no ready-made tools for such a highly specialised task. Thus: Doing it by formulae using standard functions and operations (spreadsheet-do) would require to prepare the respective formula in every single cell of the range where probably a dislocated value is to be expected.

Doing it with formulae based on a user function pushing the data by side-effects would -1- violate one of the principles of spreadsheets -2- require to enter the respective formulae either in an extra sheet or in the importing sheet, to activate them after the import, and to disable them later.

Doing it with a user Sub explicitly called should be the better way concerning the above statements.

For a very primitive (inflexible) way to do it, you will need about 25 lines of BASIC code.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2018-02-19 13:52:23 +0200

Seen: 51 times

Last updated: Feb 19 '18