brooklyn1976

New Member
Joined
May 14, 2012
Messages
25
Not sure if this is an Excel question per se, but hopefully someone can point me in the right direction.


I have received two txt files, lets call them “F” and “P.”


F contains 1372 lines each with approximately 330 characters (including spaces).
P contains 302 lines each with approximately 353 characters (including spaces).


The files contain data that should be broken into columns, but the files do not contain any delimiters so I cannot import into Excel until I add them to the files.


Is there a program or script i can use to add delimiters at the same locations on each line of the files.


I am using a Mac and have minimal experience with VBA. Any help is greatly appreciated. Thanks!!


For “F” I want a delimiter after the following characters on each line:
12
20
26
32
44
46
50
54
62
74
83
85
92
101
110
117
124
133
135
142
149
156
163
170
178
185
190
201
202
203
204
205
209
210
211
212
219
226
227
236
238
240
247
254
261
270
282
293
304
315
326




For “P”:
12
20
22
26
30
37
38
44
54
66
75
77
84
93
102
111
118
125
127
134
141
148
155
162
169
177
184
189
200
201
202
203
204
208
209
221
222
223
238
239
240
249
251
253
260
267
274
283
292
304
315
326
337
348
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
If you mean you want all those values on a single line separated by commas, then I would suggest this.
Open the file in Word.
Do a Find and Replace:
Find: ^p
Replace: ,
Click on Replace All

If you end up with an ending comma at the end, just delete that.
 
Last edited:
Upvote 0
If you mean you want all those values on a single line separated by commas, then I would suggest this.
Open the file in Word.
Do a Find and Replace:
Find: ^p
Replace: ,
Click on Replace All

If you end up with an ending comma at the end, just delete that.

Thanks for the reply, Scott. I was actually looking for a way to add multiple commas to each line of text.

For example, for the “F” text file, I want a delimiter after the 12th character, 20th character, 26th character, etc. of each line.

Thanks!
 
Upvote 0
Rather than adding a delim, you can use text to columns conversion & select fixed width, then next & set you widths accordingly.
 
Upvote 0
Thanks!! That is exactly what I need. However, there is one issue. The wizard screen (window is titled "Text Import Wizard - Step 2 of 3") only shows 107 characters and I cannot get it to move over to view and edit the data to the right (characters 108 to 300+). Any ideas?
 
Upvote 0
That suggests that you only have ~107 characters, I've just done a test & it shows upto 310

Just checked in 2003 version & that shows upto 260, but has cropped the text.
 
Last edited:
Upvote 0
Glad to help & thanks for the feedback.

Is this something that yo do on a regular basis?
 
Upvote 0

Forum statistics

Threads
1,214,636
Messages
6,120,669
Members
448,977
Latest member
moonlight6

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