Extracting the first number only in the following string

manzier

Board Regular
Joined
Jul 21, 2014
Messages
96
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
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
 
Upvote 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)))))
 
Upvote 0
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
 
Upvote 0

Forum statistics

Threads
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.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

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

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

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
Back
Top