View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Ron Rosenfeld Ron Rosenfeld is offline
external usenet poster
 
Posts: 5,651
Default How to retrieve number from filename?

On Fri, 14 Dec 2007 16:34:01 -0800, Eric
wrote:

Does anyone have any suggestions on how to retrieve number from filename?
Filename: "Eric - up 2 R.xls"
I would like to retrieve the any number within the filename, and return this
number into cell A2.
Does anyone have any suggestions?
Thanks in advance for any suggetions
Eric


If the numbers are consecutive within the text string, then:

=LOOKUP(9.99999999999999E+307,--MID(A1,MIN(
SEARCH({0,1,2,3,4,5,6,7,8,9},A1& "0123456789")),
ROW(INDIRECT("1:"&LEN(A1)))))


If they might not be consecutive, I would use a VBA UDF.
--ron