View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Ron Coderre
 
Posts: n/a
Default Extract just numeric part of mixed text/number entry?

For a value in A1

If the numbers will always be the final characters in the cell contents, try
this:
B1: =MID(A1,MIN(SEARCH({0,1,2,3,4,5,6,7,8,9},A1&"01234 56789")),99)*1

(note: that formula returns an error if there are no numbers in the cell)


This formula finds numbers anywhere in the cell (returns zero if none):
B1:
=LOOKUP(99^99,--("0"&MID(A1,MIN(SEARCH({0,1,2,3,4,5,6,7,8,9},A1&"0 123456789")),ROW($1:$10000))))

Note: in case text wrap impacts the display, there are no spaces in those
formulas.

Does that help?
***********
Regards,
Ron

XL2002, WinXP


"Heidi" wrote:

I've got a column of values like AB2.5 and CG24.3 (this is automatically
generated by a machine and I can't change it).

I want to extract just the numeric part (2.5 or 24.3) and have Excel treat
it as a number.

The letters and numbers are variable in length, so I can't just use LEFT,
RIGHT and LEN statements to trim the first/last few characters out.

Any ideas?

Thank you!
Heidi