ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Exporting to a txt file in a certain format. (https://www.excelbanter.com/excel-discussion-misc-queries/2580-exporting-txt-file-certain-format.html)

johnfli

Exporting to a txt file in a certain format.
 
I have an excel sheet that I need to export into a certain format.
I will need to have it so each column will only export the first (x) amount
of characters in each cell, then add a SPACE, then add the first (x) amount
of characters from teh next cell.

How do I do that?



Dave O

Hi, John-
Suppose your existing data is in a tab called Sheet1; cell A1 contains
the text string ABCDE; cell B1 contains a number 12345.

Insert a new tab in the workbook- for purposes of this example I used
the default name Sheet2. In cell Sheet2!A1 enter this formula:
=MID(Sheet1!A1,1,3)&" "&MID(Sheet1!B1,1,3)
The result in Sheet2!A1 is "ABC 123".

The MID function returns a portion of a string function that you
indicate: in this example, it starts in Sheet1!A1 in column 1 and
returns the first 3 columns. The ampersand in the middle is a
concatenator that joins the results of different functions.
Can you modify this example to fit your application?


Harald Staff

Not very easy. See if this gets you started:
http://www.erlandsendata.no/english/...extexportfixed

HTH. Best wishes Harald

"johnfli" skrev i melding
...
I have an excel sheet that I need to export into a certain format.
I will need to have it so each column will only export the first (x)

amount
of characters in each cell, then add a SPACE, then add the first (x)

amount
of characters from teh next cell.

How do I do that?





Dave O

Forgot to mention: you can then export Sheet2 in the .TXT format of
your choice.


Earl Kiosterud

John,

Here's a solution similar to that of Dave O.

In a separate mirror sheet, in A1:

=LEFT(Sheet1!A1, x)

Copy this sufficiently down and across using the Fill Handle. Now write
this sheet using the Text Write Program (a free Excel workbook) at
www.smokeylake.com/excel. Set the field delimiter to a space.

--
Earl Kiosterud
mvpearl omitthisword at verizon period net
-------------------------------------------

"johnfli" wrote in message
...
I have an excel sheet that I need to export into a certain format.
I will need to have it so each column will only export the first (x)
amount
of characters in each cell, then add a SPACE, then add the first (x)
amount
of characters from teh next cell.

How do I do that?





johnfli

Yeah, I might be able to use that. Thanks.
After testing it, I'll convert it into a macro.

Thanks again!


"Dave O" wrote in message
ups.com...
Hi, John-
Suppose your existing data is in a tab called Sheet1; cell A1 contains
the text string ABCDE; cell B1 contains a number 12345.

Insert a new tab in the workbook- for purposes of this example I used
the default name Sheet2. In cell Sheet2!A1 enter this formula:
=MID(Sheet1!A1,1,3)&" "&MID(Sheet1!B1,1,3)
The result in Sheet2!A1 is "ABC 123".

The MID function returns a portion of a string function that you
indicate: in this example, it starts in Sheet1!A1 in column 1 and
returns the first 3 columns. The ampersand in the middle is a
concatenator that joins the results of different functions.
Can you modify this example to fit your application?





All times are GMT +1. The time now is 08:37 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com