# Convert Number from Excel

## Recommended Posts

I have a number in a data column in excel displaying 4.72E+16, but I need it to read 47200000000001001. Currently I am achieving this in Excel by formatting the cells to a Number with 0 decimal places and entering 01 for the type in Custom. Is there a JavaScript in FusionPro to achieve this same result?
##### Share on other sites

Should this be posted on a different board?
##### Share on other sites

I think that's really something that you should convert in Excel by changing the field type to "text" rather than "number." Especially since "4.27E+16" is equal to "47200000000000000."

But if you're okay with that, something like this might work for you:

```var s= Field("YOUR FIELD");
s = s.split("E");
return Math.pow(10,Int(s[1])) * s[0];
```

##### Share on other sites

Thanks Step. That works, but I need it to add the 1 at the end. Will I be able to modify this code so that the number will display as 472000000000000001?
##### Share on other sites

I assume you want the 14th digit to be a "1" also? This goes back to what I was saying about if you want the literal number you should edit the data in Excel. Do you have an example of some of the other numbers you'd like to convert and what their output should be?
##### Share on other sites

Sorry Step. I think I copied an old number. The only number that will truly need to be a "1" is the last digit. I am just trying to keep from having to touch the Excel spreadsheet at all and have FusionPro do all of the work. I cannot get the output I want in Excel by converting it "text" without also going through the extra step of formatting the cell to "custom" and changing the type to "01".

Here is another example: 4.72E+16 needs to convert to 472001055674610001

##### Share on other sites

Both of your examples are "4.72E+16" but convert to two completely different numbers. There is not way to write logic to convert the numbers (other than using Excel) from my perspective.
##### Share on other sites

That's what I was afraid of. Thank you for your help Step.

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×

• #### FusionPro.com

• MarcomCentral
×
• Create New...