Extract number from text string - Excel

I am trying to infer a number from the middle of a line of text in excel. a string is a mixture of alpha, numeric, and some characters.

Example data row: -

Web Address /products_list.php?retailer=8&cat=43 /products_list.php?retailer=22&cat=43 /products_list.php?retailer=8&cat=1011 /products_list.php?retailer=81&cat=1023 /products_list.php?retailer=147&cat=1224 /products_list.php?retailer=8&cat=1 /products_list.php?retailer=147&cat=4 /products_list.php?retailer=147&cat=401 

I want to reach

example excel

I got to all the numbers from the text, but really could not understand how easy it is to get the numbers in the middle or at the end.

My code to fix the problem was: -

 =SUM(MID(0&A3,LARGE(ISNUMBER(--MID(A3,ROW(INDIRECT("1:"&LEN(A3))),1))*ROW(INDIRECT("1:"&LEN(A3))),ROW(INDIRECT("1:"&LEN(A3))))+1,1)*10^ROW(INDIRECT("1:"&LEN(A3)))/10) 

SCE for array formula.

If possible, I would prefer a formula over a macro.

oh if it matters im using Excel 2010.

+6
source share
2 answers

Retailer (B2):

 =LEFT(RIGHT(A2,LEN(A2)-FIND("=",A2)),FIND("&",RIGHT(A2,LEN(A2)-FIND("=",A2)))-1) 

Cat Number (C2):

 =RIGHT(A2,LEN(A2)-(FIND("cat=",A2)+3)) 

drag the formula down and

enter image description here

+5
source

It looks really ugly (I'm not an Excel expert), but it worked with the list you provided.

Formula for seller:

 =MID(A2,FIND("retailer=",A2)+9,FIND("&",A2)-(FIND("retailer=",A2)+9)) 

Formula for cat number:

 =MID(A2,FIND("cat=",A2)+4,100) 
+2
source

Source: https://habr.com/ru/post/958074/


All Articles