View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Duke Carey Duke Carey is offline
external usenet poster
 
Posts: 1,081
Default Extracting a numbers from a text string

You ask too much. From your first statement of the problem the target number
is the second of 2 bracketed by spaces. Now you completely change the
criteria. Moreover, there are at least TWO numbers with decimals in the
example you provided, and you would want to skip them both, right?

You apparently want an infinitely flexible solution.


"IPerlovsky" wrote:

Thanks, that worked great! One caveat though - what if the number in question
comes with or without a "-" (negative sign) accompaniment (ie, "-8") and/or
the number that I am trying not to extract has a decimal behind it with up to
2 decimpal places (ie, "5.75")?

--
iperlovsky


"Elkar" wrote:

Based solely on the criteria you provided, this should work:

=MID(MID(A1,SEARCH(" ? ",A1)+1,LEN(A1)),SEARCH(" ? ",MID(A1,SEARCH(" ?
",A1)+1,LEN(A1)))+1,1)

HTH,
Elkar


"IPerlovsky" wrote:

How would I extract a number (or series of numbers) using a single cell
formula from an alphanumeric text string that also contains spaces? One key
component of the number(s) in question, is that they have a space on either
side. See the example of the text string below:

"A 544646-BA CALIF UN1MM+ 5 7/1/2017 FSA 108.579 3.90 3.82 8 Aaa AAA"

In this example, I am trying to extract the number "8". However, there is
also the number "5", which appears first, and that I want to avoid
extracting. Additionally, the formula should be able to extract any number,
not specific to "8" or "5". This formula should always skip the first single
number surrounded by spaces ("5" in this example) and extract the second
number(s) ("8" in this example).

--
iperlovsky