# Extracting the first number only in the following string

#### manzier

##### Board Regular
Hi all,

I have text like the following:

<tbody></tbody>
 Num: 73, Percentage: 20.39% Num: 260, Percentage: 72.63% Num: 2, Percentage: 1.43%

<tbody>
</tbody>

How can I write one formula to just pull the first number only? Taking into account that the number can be anywhere from 1-3 digits long?

I tried using a simple LEFT and MID formula but I couldn't account for the different number sizes

Any suggestions? Thanks!

### Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple

=TRIM(MID(A1,FIND(" ",A1),FIND(",",A1)-FIND(" ",A1)))

Assuming the number is ALWAYS preceded with the text "Num: "
And the number is ALWAYS 1 to 3 digits, never 4 or more.

=SUBSTITUTE(MID(A1,6,3),",","")+0

Hi,

Try this

=LOOKUP(1E+100,--MID(A1,SMALL(FIND({0,1,2,3,4,5,6,7,8,9},A1&"0123456789"),1),ROW(INDIRECT("1:"&LEN(A1)))))

Actually I got it. Used this formula:

=TRIM(LEFT(SUBSTITUTE(REPLACE(C2,1,FIND("@",SUBSTITUTE(C2,":","@",1)),""),",",REPT(" ",100),1),100))

Thanks to Richard Schollar in here

That works too, thanks MikeLH!

Thanks Jonmo1 that works as well

Replies
2
Views
131
Replies
9
Views
335
Replies
7
Views
534
Replies
19
Views
474
Replies
14
Views
1K

1,207,261
Messages
6,077,359
Members
446,279
Latest member
hoangquan2310

### We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.

### Which adblocker are you using?

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

### Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

### Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back