View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default Extract Digits Questions

Because it does it one digit at a time, so the sequence goes

extract 1 and append it, giving text "1"
multiply by 1 gives numeric 1

extract 2 and append it, giving text "12"
multiply by 1 gives numeric 12

extract the dot and append it, giving text "12."
multiply by gives numeric 12

extract the 3 and append it, giving text "123"
multiply by 1 gives 123

As you can see the behaviour is not so odd, it is just being transformed
back and forth between text and numeric.

The change I made takes each character at a time, ignoring anything not
numeric and not a dot, and creates a string of this. In the example above,
it creates a string "12.3", which is multiplied by 1 at the end, thereby
giving the correct numeric value.

--

HTH

RP
(remove nothere from the email address if mailing direct)


wrote in message
ups.com...
While I get in theory what you are saying that the *1 changes it from
text to a number, but why does it seem to behave odd? If you run that
formula on a cell that only has 12.3, it returns 123. 12.3 is totally
different than 123 so if ExtractDigits = 12.3, then I don't see why
ExtractDigits * 1 would be 123?

Thanks,
Andrew V. Romero