Import data in Excel that doesn't have a row delimiter, but number of columns is known

Posted by Alex B on Super User See other posts from Super User or by Alex B
Published on 2012-11-07T23:20:29Z Indexed on 2012/11/08 17:06 UTC
Read the original article Hit count: 194

So i have this text file that looks something like this:

Header1 Header2 Header3 Header4 A1 B1 C1 D1 A2 B2 C2 D2

and so on.

When imported, I'd want the data to format itself in 4 columns. I tried the Get External Data from Text, and it successfully imports it, but it doesn't wrap it around, so it just keeps making columns for every space. I'd want it to go on the next line after 4 (in this case) elements have been added.

What's the simplest way to achieve this?

EDIT: My answer follows, since I'm not yet allowed to answer my own questions yet.

The Excel function I needed is called indirect().

Not sure how it actually works though, so hopefully someone can help out with that, but the function call that worked for me is

=INDIRECT(ADDRESS((ROW(A1)-1)*4+COLUMN(A1),1))

which i found over here: http://www.ozgrid.com/forum/showthread.php?t=101584&p=456031#post456031

Note: this required me to add the text to excel where i'd get this row full of columns, and then flip it so that i'd have a column full of rows.

© Super User or respective owner

Related posts about microsoft-excel

Related posts about excel-2010