Extract numbers from cell after 5th / character

eaxlns

New Member
Joined
Apr 18, 2019
Messages
15
Office Version
  1. 365
Platform
  1. MacOS
Hi All,
Hope some of you clever folk can help me. I wanted to extract the number in the following URL, it is after the fifth "/", and before the "?":

[TABLE="width: 87"]
<colgroup><col width="87" style="width: 65pt;"></colgroup><tbody>[TR]
[TD="width: 87"]https://www.ebay.co.uk/itm/TomTom-GO-520-5-Sat-Nav-Wi-Fi-Lifetime-World-Maps-Traffic-Speed-Cameras-Updates/201742112656?hash=item2ef8c45790:g:3gEAAOSwBzpbjrNH[/TD]
[/TR]
</tbody>[/TABLE]

The number in this case is 201742112656.

Thanks in advance!
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
with PowerQuery aka Get&Transform:

[Table="width:, class:head"]
[tr=bgcolor:#FFFFFF][td=bgcolor:#70AD47]url[/td][td=bgcolor:#70AD47]Text Between Delimiters[/td][/tr]

[tr=bgcolor:#FFFFFF][td=bgcolor:#E2EFDA]https://www.ebay.co.uk/itm/TomTom-GO-520-5-Sat-Nav-Wi-Fi-Lifetime-World-Maps-Traffic-Speed-Cameras-Updates/201742112656?hash=item2ef8c45790:g:3gEAAOSwBzpbjrNH[/td][td=bgcolor:#E2EFDA]201742112656[/td][/tr]
[/table]


Code:
[SIZE=1]let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    Between = Table.AddColumn(Source, "Text Between Delimiters", each Text.BetweenDelimiters([url], "/", "?", 4, 0), type text)
in
    Between[/SIZE]

or

Code:
[SIZE=1]let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    Extract = Table.TransformColumns(Source, {{"url", each Text.BetweenDelimiters(_, "/", "?", 4, 0), type text}})
in
    Extract[/SIZE]
 
Last edited:
Upvote 0
Try:

=TRIM(LEFT(SUBSTITUTE(MID(A1,FIND("|",SUBSTITUTE(A1,"/","|",5))+1,LEN(A1)),"?",REPT(" ",LEN(A1))),LEN(A1)))
 
Upvote 0
Thank you for your speedy reply, sandy666, but how can I do this as a formula, as I need the result in another sheet's cell?
 
Upvote 0
this is a PowerQuery so you'll need Excel 2010/2013 and PQ add-in or 2016 and above with PQ (Get&Transform) built-in

Formula is in post #3 by Eric W
 
Upvote 0
How about:

=TRIM(MID(SUBSTITUTE(SUBSTITUTE(A1,"/",REPT(" ",500),5),"?",REPT(" ",500)),500,500))
 
Upvote 0
One more...

=TRIM(MID(SUBSTITUTE(SUBSTITUTE(A1,"?","/"),"/",REPT(" ",500)),2500,500))
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,240
Members
452,621
Latest member
Laura_PinksBTHFT

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