Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a user with a query from an SQL Database that returns a series of string in this form:

000123123.23000
000123123.23000
000123123.23000
000123123.23000
000123123.23000

These are really numbers, however they cannot be summed. The correct way to fix this might be to cast the data in the SQL query, but then the Excel query viewer can't display it. As a workaround I do

 = <CELL> +1 -1.

Is there a more elegant solution?

share|improve this question

2 Answers 2

up vote 19 down vote accepted

I think the value function can be useful for you

 = VALUE(< CELL >)

PD:

In spanish we use the function VALOR:

 = VALOR(< CELL >)

i think it should be the same on english

share|improve this answer
    
Exactly what I was looking for! I thought there might be an eval() or such function -- but this is it! –  SirStan Aug 20 '09 at 13:54
    
glad to be helpful !!! –  Jhonny D. Cano -Leftware- Aug 20 '09 at 14:00

I use this little macro

Sub txttonum()
    For Each tcell In Selection.Cells
        If TypeName(tcell.Value) = "String" Then
            tcell.Value = Val(tcell.Value)
        End If
    Next
End Sub

Which converts all the highlighted cells to numbers if they're strings

share|improve this answer
    
This won't work on a database query area unfortunately. –  SirStan Aug 20 '09 at 13:54
    
Good point, I don't think there's any way to fix the data in situ if it's coming from a query. I guess the value function is the best one for you. –  Col Aug 20 '09 at 15:19

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.