Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 190
Default Change a # w/decimal places to no decimals, 13 char's, w/leading 0

To import data into SAP from Excel, I need to create a load file that
converts a column w/positive or negative values & decimal places into all
positive values with no decimal places, and with leading zeroes--to fill out
13 places. For example:

-74737.76069 needs to be converted to
0000747376069
and
105286.99 needs to be converted to
0000010528699



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,316
Default Change a # w/decimal places to no decimals, 13 char's, w/leading 0

Are the resulting values numeric or character. If numeric you can create a
custom format that pads cells with 0's. The format would be "00000000000000"
so that any position not having a corresponding number will display a 0
instead.

If it's a string the following function might be of some assistance:

Function ConvertVals(Value As Double) As String

Dim strVal As String
Dim i As Integer
Application.Volatile

If Value < 0 Then Value = Value * -1

strVal = CStr(Value)
strVal = Replace(strVal, ".", "")
i = Len(strVal)

Do Until i = 13
strVal = "0" & strVal
i = Len(strVal)
Loop

ConvertVals = strVal

End Function

--
Kevin Backmann


"Mary" wrote:

To import data into SAP from Excel, I need to create a load file that
converts a column w/positive or negative values & decimal places into all
positive values with no decimal places, and with leading zeroes--to fill out
13 places. For example:

-74737.76069 needs to be converted to
0000747376069
and
105286.99 needs to be converted to
0000010528699



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 168
Default Change a # w/decimal places to no decimals, 13 char's, w/leading 0

If you wanted to use a formula, you could try something like this.

=IF(LEN(SUBSTITUTE(SUBSTITUTE(A1,".",""),"-",""))<13,(REPT("0",13-LEN(SUBSTITUTE(SUBSTITUTE(A1,".",""),"-","")))&SUBSTITUTE(SUBSTITUTE(A1,".",""),"-","")))

This is with your original value in A1.

HTH,
Paul

"Mary" wrote in message
...
To import data into SAP from Excel, I need to create a load file that
converts a column w/positive or negative values & decimal places into all
positive values with no decimal places, and with leading zeroes--to fill
out
13 places. For example:

-74737.76069 needs to be converted to
0000747376069
and
105286.99 needs to be converted to
0000010528699





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,651
Default Change a # w/decimal places to no decimals, 13 char's, w/leading 0

On Mon, 30 Jan 2006 08:41:49 -0800, "Mary"
wrote:

To import data into SAP from Excel, I need to create a load file that
converts a column w/positive or negative values & decimal places into all
positive values with no decimal places, and with leading zeroes--to fill out
13 places. For example:

-74737.76069 needs to be converted to
0000747376069
and
105286.99 needs to be converted to
0000010528699



Assuming your first example has a typo, then:

=TEXT(SUBSTITUTE(A10,".",""),REPT("0",13)&";"&REPT ("0",13))

(returns 0007473776069 and not
0000747376069)



--ron
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
decimal places and leading zeros Vic Excel Discussion (Misc queries) 2 July 3rd 08 07:31 PM
How to change complex 0.122345687+0.87659454j to 3 decimal places erwan Excel Discussion (Misc queries) 3 March 4th 08 03:18 PM
how do I change default decimal places? Jason Excel Discussion (Misc queries) 4 June 22nd 06 09:33 PM
How to change decimal places in balance sheet template jdport Excel Worksheet Functions 1 May 10th 06 08:29 AM
How do I change the number of decimal places displayed in Excel Dan Excel Discussion (Misc queries) 1 February 23rd 05 10:31 PM


All times are GMT +1. The time now is 01:59 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"