Select to view content in your preferred language

Converting String Data to Double or Precision

3912
8
09-27-2016 06:33 AM
NMDC2015COMMERCIAL
Deactivated User

Dear All,

 

Please can anyone tell me how i can convert an attribute field in strings to to Double or Precision Numeric.

i have imported the data from an excel file and it has read the column as String even though the columns are numeric values due to this string issue i can not perform the kriging operation because i want to use these columns as my z in the kriging operation.

Thanks

0 Kudos
8 Replies
MitchHolley1
MVP Regular Contributor

1.) Add a field to the table that is a double or precision data type

2.) Field Calculate the newly added field to the 'string' field values

I'm assuming you're using ArcGIS...

NMDC2015COMMERCIAL
Deactivated User

thanks Mitch.

i have tried this method field calculate with the above steps before now but i keep getting this error message. 

0 Kudos
NMDC2015COMMERCIAL
Deactivated User

i have used this VB script .....CDbl(String) but i keep getting this error message and no data was found in the new field created. please a quick help will be appreciated. thanks

0 Kudos
NeilAyres
MVP Alum

"..getting this error message"

Sorry, but what error message?

0 Kudos
NMDC2015COMMERCIAL
Deactivated User

i guess i was getting that because i did not convert the file to goedatabase file. so for the VB script to work i have to convert first to geodatabse so its all ok now.

Thanks

0 Kudos
AdrianWelsh
MVP Honored Contributor

I second what Mitch has said. Also, what type of data are you trying to make? A shapefile? Geodatabase?

Another thing you can do is, in Excel, be sure the entire data column is set to be numeric. Format the cells for the entire column and select Number for the category

MarkEllis
Emerging Contributor

Second the above suggestions. To troubleshoot further (if the calculation starts, but fails), strip any extra characters from the text string source field.  A single extra space or letter can bail the calculation when it reaches that record.

0 Kudos
AdrianWelsh
MVP Honored Contributor

Was this issue ever resolved?

0 Kudos