ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Keep Trailing Zeros When Convert To Text (https://www.excelbanter.com/excel-discussion-misc-queries/79172-keep-trailing-zeros-when-convert-text.html)

Todd G

Keep Trailing Zeros When Convert To Text
 
Is there a way any one knows about to keep the 00 portion with the dollar
amount when you convert to a text format.
e.g. $234.00 converted to text to be 23400, not like it automatically does
234.

The other amounts where there are actual cents work fine as we all know, but
I need everything, no matter if there are pennies or not.

Dave Peterson

Keep Trailing Zeros When Convert To Text
 
It sounds like you're not just saving as a text file (.txt or .prn).

I like to use helper columns and put formulas in that make it what I want:

=text(a1*100,"000000")

for instance.

Not knowing what you're doing....

Are you trying to create a fixed width text file?

If you are, you could concatenate the cell values into another column:

=LEFT(A1&REPT(" ",5),5) & LEFT(B1&REPT(" ",4),4) & TEXT(C1*100,"00000000")

(You'll have to modify it to match what you want.)

Drag it down the column to get all that fixed width stuff.

Then I'd copy and paste to notepad and save from there. Once I figured out that
ugly formula, I kept it and just unhide that column when I wanted to export the
data.

If that doesn't work for you, maybe you could do it with a macro.

Here's a link that provides a macro:
http://google.com/groups?threadm=015...0a% 40phx.gbl

Todd G wrote:

Is there a way any one knows about to keep the 00 portion with the dollar
amount when you convert to a text format.
e.g. $234.00 converted to text to be 23400, not like it automatically does
234.

The other amounts where there are actual cents work fine as we all know, but
I need everything, no matter if there are pennies or not.


--

Dave Peterson

Stefi

Keep Trailing Zeros When Convert To Text
 
=TEXT(A1,"0.00") gives 234.00!
If you really don't need decimal point, then
=SUBSTITUTE(TEXT(A1,"0.00"),".","")

Regards,
Stefi


Todd G ezt *rta:

Is there a way any one knows about to keep the 00 portion with the dollar
amount when you convert to a text format.
e.g. $234.00 converted to text to be 23400, not like it automatically does
234.

The other amounts where there are actual cents work fine as we all know, but
I need everything, no matter if there are pennies or not.



All times are GMT +1. The time now is 06:52 PM.

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