Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Extract 2, 3, 4 or 5-digit number from string

I have a list of URLs where some contain the parameter "categoryid="
with either a 2, 3, 4, or 5 digit number. I need to extract that
number, as an integer, into a neighboring column. I need a routine or
function to help with this - something along the line of making the mid
function smart enough to recognize numbers and adjust the length value
so it only takes the numbers. And if it doesn't find "categoryid",
then leave the cell blank.

TIA,
Jim

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Extract 2, 3, 4 or 5-digit number from string


Jim,
If the text string is in cell D6 - try this.

=IF(ISERROR(SEARCH("categoryid=",D6)),"",MID(D6,SE ARCH("categoryid=",D6)+11,LEN(D6)-SEARCH("categoryid=",D6)+11))

This function assumes that the numbers are on the end of the text
string. if there is a constant text ending - such as ".com" or
something, simply subtract the length of that string ending from the
mid function.


--
barrfly

Excel User - Energy markets
------------------------------------------------------------------------
barrfly's Profile: http://www.excelforum.com/member.php...fo&userid=4141
View this thread: http://www.excelforum.com/showthread...hreadid=376856

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Extracting 7 digit number from alphanumeric string snowball Excel Discussion (Misc queries) 5 August 31st 09 11:51 AM
EXTRACT NUMBER FROM STRING aRJUN SINGH RAWAT SINGH SRAWAT TATDT Charts and Charting in Excel 1 July 24th 09 08:23 AM
Change a 1,2,3 or 4 digit number to a 6 character text string Steve D Excel Worksheet Functions 3 March 28th 08 08:14 PM
How to extract each digit from a number in one cell? greyhound girl Excel Discussion (Misc queries) 4 November 9th 06 07:42 PM
How to extract the Number from a String johnbest New Users to Excel 3 December 19th 05 06:23 PM


All times are GMT +1. The time now is 06:54 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"