View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
RADO[_2_] RADO[_2_] is offline
external usenet poster
 
Posts: 2
Default Reading specific digits from a numeric variable

One way is to convert your number to a string first (using
CStr function), then use string functions to get your
digits (i.e., Mid(YourNumber, 3, 5)) and convert them back
to numbers.

Another way is to devide your numbers by corresponding
power of 10 and take integer part. I.e., to extract one
digit in the 3-rd position from number 1735, devide it by
mod 10^3 (x mod 10^3) to get 0.735, then multiply by 10^1
to get 7.35, and take integer (7). As you can see, power
of 3 is the starting position, and power of 1 is the
number of digits to extract. You can right a simple
function now.


-----Original Message-----
How can I read specific digits (e.g. last five digits, or

the middle five or
whatever..) from a numerical variable (A)?

The digits I read from variable A, I need to put in

another numeric variable
(B).

Thanks in advance!
srdjan


.