Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am combining 2 lists in 2 columns in XL. The index in both lists is
in the format: 01-Adams. There is one for each county in the state. I want to know how to convert the 01 text part to a numeric value to compare to another one and determine where they should be in a table. If I do a strOrigCtyNo = Right(strOrig, Len(strOrig) + 2) I believe it will give me the first 2 characters of the code. How do I convert them to an integer constant to compare them, or do I even have to? If I remember right from my old programming days, comparing numbers in ASCII sometimes gives different results from comparing numbers. Is that still true in VBA? What is the best way to proceed here? Thanks again! |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
in VBA there are functions CInt, CDbl, ... which convert text to value. You
should be albe to use CInt to convert teh first two digits to an number. -- HTH... Jim Thomlinson "davegb" wrote: I am combining 2 lists in 2 columns in XL. The index in both lists is in the format: 01-Adams. There is one for each county in the state. I want to know how to convert the 01 text part to a numeric value to compare to another one and determine where they should be in a table. If I do a strOrigCtyNo = Right(strOrig, Len(strOrig) + 2) I believe it will give me the first 2 characters of the code. How do I convert them to an integer constant to compare them, or do I even have to? If I remember right from my old programming days, comparing numbers in ASCII sometimes gives different results from comparing numbers. Is that still true in VBA? What is the best way to proceed here? Thanks again! |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Jim Thomlinson wrote: in VBA there are functions CInt, CDbl, ... which convert text to value. You should be albe to use CInt to convert teh first two digits to an number. -- HTH... Jim Thomlinson "davegb" wrote: I am combining 2 lists in 2 columns in XL. The index in both lists is in the format: 01-Adams. There is one for each county in the state. I want to know how to convert the 01 text part to a numeric value to compare to another one and determine where they should be in a table. If I do a strOrigCtyNo = Right(strOrig, Len(strOrig) + 2) I believe it will give me the first 2 characters of the code. How do I convert them to an integer constant to compare them, or do I even have to? If I remember right from my old programming days, comparing numbers in ASCII sometimes gives different results from comparing numbers. Is that still true in VBA? What is the best way to proceed here? Thanks again! Thanks, Jim! |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
if the first two digits are on the left side of the string, I don't think
this is what you want: strOrigCtyNo = Right(strOrig, Len(strOrig) + 2) strOrigCtyNo = Left(strOrig,2) a way to do the conversion would be Dim lngOrigCityNo as Long lngOrigCityNo = Left(strOrig,2) -- Regards, Tom Ogilvy "davegb" wrote in message oups.com... Jim Thomlinson wrote: in VBA there are functions CInt, CDbl, ... which convert text to value. You should be albe to use CInt to convert teh first two digits to an number. -- HTH... Jim Thomlinson "davegb" wrote: I am combining 2 lists in 2 columns in XL. The index in both lists is in the format: 01-Adams. There is one for each county in the state. I want to know how to convert the 01 text part to a numeric value to compare to another one and determine where they should be in a table. If I do a strOrigCtyNo = Right(strOrig, Len(strOrig) + 2) I believe it will give me the first 2 characters of the code. How do I convert them to an integer constant to compare them, or do I even have to? If I remember right from my old programming days, comparing numbers in ASCII sometimes gives different results from comparing numbers. Is that still true in VBA? What is the best way to proceed here? Thanks again! Thanks, Jim! |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks again, Tom!
|
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
convert a numeric number in text format in another cell? | Excel Worksheet Functions | |||
Extract just numeric part of mixed text/number entry? | Excel Worksheet Functions | |||
Numeric in Text to convert back to the form of Numeric for VLookup Purposes | Excel Discussion (Misc queries) | |||
how can I convert numeric number into text | Excel Discussion (Misc queries) | |||
convert a number in Excel from numeric to text, i.e. "1" to "one" | Excel Worksheet Functions |