aQUIRING DATA FROM TEXT

selkov

Well-known Member
Joined
Jan 26, 2004
Messages
781
I have a text file with 5000+ entries.
the format is :"data - data - data - data - data"
I want to export it to excel & columize the seperate data fileds.

However the lenght of the data varies so I can not use the left() or Mid() functions.

I need a script that will read left to "-" where the # of spaces to the left of each "-" will change from line to line.

Any help is apreciated.....
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Maybe I am not understanding the question fully, but can't you just use the the "-" as your delimiter to split your data into the appropriate columns?
 
Upvote 0
If it's a .txt file and you open it in Excel, you will be presented with the Text Import Wizard. If you choose Delimited at Step 1 you can specify the delimiters at Step 2.
 
Upvote 0
No,
When I open the text file via "open with" excel dumps all the data into 1 colum.
 
Upvote 0
Instead of doing an "Open With", go into Excel first, then open the File from inside Excel. That should trigger the Import Wizard where you can specify your delimiter.

-OR-

If it is in Excel as one column, you can use Text to Columns (under the Data menu) to split the one column into multiple ones using a delimiter.
 
Upvote 0
If that's the case click the column header and choose Data|Text to Columns from the menu. You'll get the same Wizard.
 
Upvote 0
As Andrew said, "...open it in Excel..." instead of from Windows Explorer or whatever. Opening it in Excel should start the text import wizard.
 
Upvote 0

Forum statistics

Threads
1,202,908
Messages
6,052,485
Members
444,587
Latest member
ezza59

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top