Lets imagine the text MEDIA SOLUTIONS (1005) is in cell A2. You could use the formula below.

=MID(A2,FIND(“(“,A2)+1,4)

Kind regards

Alan

]]>How would you modify -Sub ExtractNumber ()- to incorporate that formula? For instance, if you had textbox within a userform called “comments” which contained the string, and you wanted to use a command button to output the two numbers (from “comments”)to textboxes “field1” and “field2” (within the same userform) respectively?

]]>To extract the number before the X I used;

=VALUE(LEFT(A1,FIND(“”””,A1)-1))

And to extract the one after the X I used;

=MID(A1,FIND(“X”,A1)+2,FIND(“*”,SUBSTITUTE(A1,””””,”*”,2))-FIND(“X”,A1)-2)

These formulas assume that the number is in cell A1.

I hope this helps.

Alan

]]>I am trying to do something similar. I am trying to extract two numbers relative to the character “x” in a given string. I want to extract the number just before “x” into one cell, and the number just after “x” into another cell.

Example:

String:

24″ X 37.5′ cut to length with notches[etc.,etc.]

Output:

field1.Value = 24

field2.Value = 37.5

Any ideas?

]]>I have one slight variation. What if the string value is MCPT9-30390 and I need to return 30390.. The code returns 9 which is the number after “T”. How best to modify the code to return 30390 if only one cell in the selection contains that string ? ]]>

If i = Len(rng) Then

LastChar = i

Else

LastChar = i – 1

it then removed the letters from the end

]]>