Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,388
Default extract numbers from a string

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
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
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

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,081
Default extract numbers from a string

if you ALWAYS have "Rev" and ",nextrev" as the only alpha characters, then

=SUBSTITUTE(SUBSTITUTE(A1,"Rev",""),",nextrev","") *1

will work


"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

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,071
Default extract numbers from a string

Dave
If all else fails, this little macro will do it for you. I assumed your
data is in Column A starting in A1. This macro displays a message box
showing you the number for each entry in Column A. HTH Otto
Sub GetNums()
Dim rColA As Range
Dim i As Range
Dim c As Long
Dim Nums As Long
Set rColA = Range("A1", Range("A" & Rows.Count).End(xlUp))
For Each i In rColA
c = 1
Nums = 0
For c = 1 To Len(i)
If IsNumeric(Mid(i, c, 1)) Then
Nums = --(Nums & Mid(i, c, 1))
End If
Next c
MsgBox Nums
Next i
End Sub
"Dave" wrote in message
...
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


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
extract numbers from text string thomsonpa New Users to Excel 4 December 17th 07 11:02 AM
Only extract numbers from a string of text Lost in Microbiology Excel Discussion (Misc queries) 4 October 22nd 07 03:39 PM
EXTRACT NUMBERS FROM TEXT STRING fiber_doc Excel Worksheet Functions 4 November 28th 05 06:40 PM
Extract Numbers from Alpha-Numeric String MrBill Excel Worksheet Functions 1 November 2nd 05 05:44 PM
How do you extract numbers from a string of chacters in a cell (E. blackbeemer Excel Worksheet Functions 6 November 12th 04 09:00 AM


All times are GMT +1. The time now is 12:35 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"