Extract a number from a text string

dji

New Member
Joined
Jan 24, 2010
Messages
15
Hi
Can you help with a formula solution for the following as I want to extract just the number from a string of text , in this case it is 150 but it could be a single digit like 5 , but in each case the amphersam appears after the number if that helps

/index.php?page=catalogue&vehicleid=150&make=TOYOTA&v_type=LANDCRUISER

Many thanks
Steve
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
Unfortunately the ampersand appears in several other places in the string, so it's not an ideal marker.

Is it always "vehicleid=#&" ?
 
Upvote 0
try this
if b1 houses the text.

=LEFT(REPLACE(B1,1,MIN(FIND({0,1,2,3,4,5,6,7,8,9},B1&"0123456789"))-1,""),FIND("&",REPLACE(B1,1,MIN(FIND({0,1,2,3,4,5,6,7,8,9},B1&"0123456789"))-1,""))-1)
 
Upvote 0
anandvarma's suggestion should work, as should

=TRIM(LEFT(SUBSTITUTE(RIGHT(SUBSTITUTE(A1,"vehicleid=",REPT(" ",255)),255),"&",REPT(" ",255)),255))
 
Upvote 0

Forum statistics

Threads
1,221,310
Messages
6,159,173
Members
451,543
Latest member
cesymcox

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