# Thread: Extract number from the right of the string Thanks: 0 Likes: 0

1. ## Extract number from the right of the string

HI there,

I wonder if there is any way that we can extract number from the right of a string, for example:

ABC123 => 123
ABCD\$DE%34 => 34

Thank you very much!

2. ## Re: Extract number from the right of the string

Hi.

See here for some techniques:

Extracting numbers from a string 2: Consecutive numbers at end | EXCELXOR

Let me know if you need anything explaining.

Regards

3. ## Re: Extract number from the right of the string

thank you very much!

4. ## Re: Extract number from the right of the string

Originally Posted by XOR LX
Hi.

See here for some techniques:

Extracting numbers from a string 2: Consecutive numbers at end | EXCELXOR

Let me know if you need anything explaining.

Regards
In a simpler case, If the delimiter is defined, for example the "\$", is there an easy way to extract the number?

For instance:

=Tickmarks!\$A\$3 => 3
'=Tickmarks!\$ABC\$32323 =>32323
=Tickmarks!A17 => 17

5. ## Re: Extract number from the right of the string

Originally Posted by sebastriantran
In a simpler case, If the delimiter is defined, for example the "\$", is there an easy way to extract the number?

For instance:

=Tickmarks!\$A\$3 => 3
'=Tickmarks!\$ABC\$32323 =>32323
=Tickmarks!A17 => 17

6. ## Re: Extract number from the right of the string

Originally Posted by Rick Rothstein
Yes, that's my typo, it should be \$ sign instead of ! sign. I use the Instr and Left function to extract the number, but I wonder if there is any easier way to do it :D

7. ## Re: Extract number from the right of the string

Originally Posted by sebastriantran
Yes, that's my typo, it should be \$ sign instead of ! sign. I use the Instr and Left function to extract the number, but I wonder if there is any easier way to do it :D
Oh, this is a VB question. Okay, assuming cell A1 for example purposes...

Code:
` Number = Mid(Range("A1").Value, InStrRev(Range("A1").Value, "\$") + 1)`

8. ## Re: Extract number from the right of the string

Ah, sorry. Didn't realise this was a VBA question!

Regards

9. ## Re: Extract number from the right of the string

Originally Posted by XOR LX
Ah, sorry. Didn't realise this was a VBA question!
Until I saw the InStr reference in Message #6, neither did I.

## User Tag List

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•