[GIS] Cannot convert dms to dd in Excel 2007 using VBA code

databasedegrees minutes secondsexcellatitude longitudevba

I am trying to convert the data in an Excel sheet from dms (degree-minute-second) to dd (decimal degree) format using the vba script available here.

Here is sample data:

53° 0'  39.31"  6° 44'  50.14"
52° 59'  51.43" 6° 46'   0.02"

In the Excel sheet, this code is working:

=Convert_Decimal("10° 27' 36""")

but this is not working:

=Convert_Decimal(B3). 

The error is #value!

I want rows in excel in dd format. Alternatively I want to convert this Excel file into a database but the format must be dd.

Any suggestions anyone?

Best Answer

Are the longitude and latitude values in separate fields? Because the Convert_Decimal function requires a single value.

After trying this myself, I think you were trying to convert the DMS values to DD in-place. That is, in the same column. Instead, use the script in a new column, referring to the one you want to convert. See image below where I have a DMS value in column C, and calculating its DD value into column B.

Microsoft Excel 2013 calculating a DD value from DMS