extracting text between 2 text strings

SQUIDD

Well-known Member
Joined
Jan 2, 2009
Messages
2,104
Office Version
  1. 2019
  2. 2016
Platform
  1. Windows
Hi All

What is the best formula to get the number in red below, no matter what lenght the number may be.
Im confident the id= and the ">V will always be either side in green.


<tbody>
</tbody>
< a title="View Race" href="resultsRace.aspx?id=1942402">View Race
many thanks

Dave
 
Last edited:

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
Try this...
=LOOKUP(99^99,--("0"&MID(A1,MIN(SEARCH({0,1,2,3,4,5,6,7,8,9},A1&"0123456789")),ROW($1:$10000)))) Courtesy of:*Ron Coderre
 
Upvote 0
Looks like your last edit change the view of your data.
You originally had this:
Code:
id=1942402">View Race
If the value were in cell A1, this should get what you want:
Code:
=MID(A1,FIND("id=",A1)+3,FIND(">V",A1)-FIND("id=",A1)-4)
 
Upvote 0
Try this:

=LEFT(SUBSTITUTE(A1,"id=",""),FIND(">",SUBSTITUTE(A1,"id=",""))-2)

EDIT: this will not work with the amended request -sorry.
 
Last edited:
Upvote 0
dear all

sorry, it would not let me add the full string, but i think i have it now.

please see my edited post.

dave
 
Upvote 0
Both the formulas Ford and I posted seem to return what you are looking for.
 
Upvote 0
Thanks all

sorry for the confusion.
Joe, i used yours in the end.

thanks again all.

Dave
 
Upvote 0
Here is another way

=TRIM(MID(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A1,""">","|"),"id=","|"),"|",REPT(" ",99)),99,99))


Excel 2016 (Windows) 32 bit
AB
1< a title="View Race" href="resultsRace.aspx?id=1942402">View Race1942402
Sheet4
 
Upvote 0

Forum statistics

Threads
1,214,605
Messages
6,120,473
Members
448,967
Latest member
visheshkotha

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