View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Lars-Åke Aspelin[_2_] Lars-Åke Aspelin[_2_] is offline
external usenet poster
 
Posts: 913
Default extract numbers from a string

On Thu, 7 Aug 2008 12:37:01 -0700, Dave
wrote:

Hello,

We import strings of numbers into a spreadsheet looking like
this:-

12Rev999,nextrev456
124Rev8888,nextrev1234

In practice the numbers can be any length from 1 to 4 numbers and there are
always three groups. I need to extract these numbers which are in Column A to
Column C
nearly forgot to mention the numbers in this format are text and I need them
as numbers.

Hope you can help.

D


Assuming your strings are in column D you may try the following
formulas in cells A1, B1, and C1 respectivey:

=LEFT(D1,FIND("Rev",D1)-1)+0

=MID(D1,FIND("Rev",D1)+3,FIND("nextrev",D1)-FIND("Rev",D1)-4)+0

=RIGHT(D1,LEN(D1)-FIND("nextrev",D1)-6)+0

Hope this helps / Lars-Åke