danpaul23 Posted January 17, 2007 Share Posted January 17, 2007 When I try to make a number with a comma in it into a number, the number function deletes everything after the comma (which I thought, was what the Int function is supposed to do). For instance in the following code: CODE$Var1 = "27,350" $Var2 = Number($Var1) msgbox(0, "", "result: " & $Var2) I get the result "27", when I want 27350. I'm sure this is an easy fix but I couldn't find anything in the help file or elsewhere. Thanks for your help. Link to comment Share on other sites More sharing options...
Edgar Posted January 17, 2007 Share Posted January 17, 2007 You can try this. $Var1 = "27,350" $Var2 = Number(StringReplace($Var1,",","")) msgbox(0, "", "result: " & $Var2) Link to comment Share on other sites More sharing options...
danpaul23 Posted January 17, 2007 Author Share Posted January 17, 2007 You can try this. $Var1 = "27,350" $Var2 = Number(StringReplace($Var1,",","")) msgbox(0, "", "result: " & $Var2) great, that seems to work, no matter how many commas or if there a none in the expression. thanks again. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now