char to numeric value

S

sharmashanu

Hi All
I want to convert 10+930.000 to numric value. I have imported
these number and it is saved as charecter. I want the + sign also in
between once it is converted. Thanks all for any help

Regards

Shanu
 
G

Gary''s Student

Try this:

Sub convertality()
For Each r In Selection
r.Formula = "=" & r.Text
Next
End Sub
 
S

sharmashanu

It worked. Now is it possible to convert charecters with decimal eg:
"104+172.000" and ignore charecters without decimal eg: "104+180"
 
S

sharmashanu

Hi Gary
This conversion is taking out "10+" and giving me only remaining
Thanks again
 
S

sharmashanu

Hey dave..
It did as you said.but i want the 10+ also.. These are survey points.
Thanks
 
D

Dave D-C

I want the + sign also in between ..
I'm guessing you want the + sign in front.

Sub Demo()
MsgBox DCFormat("10+930.000") ' gives +940.000
End Sub

Function DCFormat$(pStr$)
Dim f1%, iPos%
iPos = InStr(pStr, "+")
f1 = Val(Left$(pStr, iPos - 1)) + _
Val(Mid$(pStr, iPos + 1))
DCFormat = IIf(f1 > 0, "+", "") & Format(f1, "000.000")
End Function ' D-C
 
D

Dave D-C

Is it always a "+" sign?
Is the number before the "+" an integer? Range?
Is the number after the "+" always 3 decimal places? Range?
Do you want 3 decimal places in your output?
From "10+930.000" do you want "10+940.000"?
If not, what?
D-C
sharmashanu wrote:
Hi All
I want to convert 10+930.000 to numric value. I have imported
these number and it is saved as charecter. I want the + sign also in
between once it is converted. Thanks all for any help
Regards
Shanu
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top