Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am trying to figure out how to convert a number string, like "11291", to a
number 11291. I am trying to use it in the following If statement: If Right(SAPws.Name, 5) = SAPws.Range("B2").Value Then Right(SAPws.Name, 5) evaluates as a string: "11291", and SAPws.Range("B2").Value evaluates as a number: 11291 I need to get the if statement to evaluate to TRUE. Please help. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() If cDbl(Right(SAPws.Name, 5)) = SAPws.Range("B2").Value Then -- Jim Cone Portland, Oregon USA "Ayo" wrote in message I am trying to figure out how to convert a number string, like "11291", to a number 11291. I am trying to use it in the following If statement: If Right(SAPws.Name, 5) = SAPws.Range("B2").Value Then Right(SAPws.Name, 5) evaluates as a string: "11291", and SAPws.Range("B2").Value evaluates as a number: 11291 I need to get the if statement to evaluate to TRUE. Please help. |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Wrapping both sides of the equation in Cstr() (convert number to string)
should do the trick. if Cstr(Right(SAPws.Name, 5)) = cstr(SAPws.Range("B2").Value) then -- Steve "Ayo" wrote in message ... I am trying to figure out how to convert a number string, like "11291", to a number 11291. I am trying to use it in the following If statement: If Right(SAPws.Name, 5) = SAPws.Range("B2").Value Then Right(SAPws.Name, 5) evaluates as a string: "11291", and SAPws.Range("B2").Value evaluates as a number: 11291 I need to get the if statement to evaluate to TRUE. Please help. |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks.
"AltaEgo" wrote: Wrapping both sides of the equation in Cstr() (convert number to string) should do the trick. if Cstr(Right(SAPws.Name, 5)) = cstr(SAPws.Range("B2").Value) then -- Steve "Ayo" wrote in message ... I am trying to figure out how to convert a number string, like "11291", to a number 11291. I am trying to use it in the following If statement: If Right(SAPws.Name, 5) = SAPws.Range("B2").Value Then Right(SAPws.Name, 5) evaluates as a string: "11291", and SAPws.Range("B2").Value evaluates as a number: 11291 I need to get the if statement to evaluate to TRUE. Please help. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Converting string to number | New Users to Excel | |||
Converting a string into a number format | Excel Discussion (Misc queries) | |||
Converting string of letters to Number | Excel Discussion (Misc queries) | |||
converting number string to number with decimal | Excel Worksheet Functions | |||
converting number to string | Excel Programming |