View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.misc
T. Valko T. Valko is offline
external usenet poster
 
Posts: 15,768
Default Help Extracting Numbers formula

Let's use this string for an example:

A1 = 3 days

=LEFT(A1,FIND(" ",A1)-1)

The LEFT function returns the specified number of characters of a string
starting from the leftmost character. We use FIND to determine the specified
number of characters.

Since the part of the string we want to extract is immediately before the
first space we find the location of that first space and then subtract 1 for
the space character itself. We use the FIND function to tell us where that
first space character id located.

3 days

FIND(" ",A1) = 2

The space is the second character in the string. We subtract 1 for the space
character itself so:

FIND(" ",A1)-1 = 1

This 1 is then passed to the LEFT function telling it we want to extract 1
character starting from the leftmost of the string "3 days".

So, the result of this formula is 3. It's important to note that the LEFT
function returns a TEXT value. Using this example the "3" we extracted is a
TEXT number not a numeric value. When combined with the other segment of the
entire formula:

=LEFT(A1,FIND(" ",A1)-1)*LEFT(A2,FIND(" ",A2)-1)

The TEXT numbers are coerced to numeric values by performing a math
operation of them. So, the final result of the entire formula is numeric
1200.


--
Biff
Microsoft Excel MVP


"Kwokman3" wrote in message
...
This works!! Thank you!!

For my knowledge, if you have the time to respond,
how do the LEFT() and FIND() functions work?

--
Kwokman


"T. Valko" wrote:

Assuming the number is always the first characters of the string followed
by
a space:

=LEFT(A1,FIND(" ",A1)-1)*LEFT(A2,FIND(" ",A2)-1)

--
Biff
Microsoft Excel MVP


"Kwokman3" wrote in message
...
Ok....sample...

If a given spreadsheet has...

3 days [in cell A1]
400 per day [in cell A2]

then in cell A3, I'd like to multiply 3 and 400.
Mind you, the cell has mixed text and numbers.

Some idiot submitted a huge spreadsheet without separating units from
number
of units!!



--
Kwokman


"T. Valko" wrote:

Need more detail.

--
Biff
Microsoft Excel MVP


"Kwokman3" wrote in message
...
Help!!

Is there a way for excel to identify cells with number in them, then
extract
the numerical data from the cell and use it in another formula?


--
Kwokman