EyeRmonkey,I told you it couldn't be done in a single formula(which is a dead lie in hindsight...), simply because the number of operations you have to do changes depending on the length of the number and what digit you're looking for(not really...i was dumb when i wrote this post).
If you want the code I came up with, here it is for ya. Fairly simple, actually. Enjoy!
VB Code:
Private Sub Command1_Click() 'Text1 is the number you would like searched 'Text2 is the digit you are looking for 'Command1.... do I need to comment on that? 'Label1 tells you what the answer is 'The problem is simple... Given any number, what is the value of the nth 'digit from the right? eg x=45364, n=3. What is the value of the third digit 'from the right? Obviously, by looking at it, it's 3. But if for some odd 'reason you can't see the number, this program will figure it out for you. 'Cheers! Dim x As Long Dim s As Integer Dim i As Integer Dim counter As Integer s = Len(Text1.Text) 'number of digits in the number n = Val(Text2.Text) 'position from the right you want to know x = Text1.Text 'your original number For counter = s To n + 1 Step -1 x = x - (Int((x / (10 ^ (counter - 1)))) * (10 ^ (counter - 1))) Next counter 'presto chango... all numbers in front of your digit are removed x = Int(x / (10 ^ (n - 1))) 'abra kadabra, all numbers behind yours are gone Label1.Caption = x 'and the magic number mystically appears in the label End Sub




Reply With Quote