Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 143
Default Extracting numbers from string of text

I am trying to extract numbers from a string of text. For example, the data
I have a

AMHERST /IN: CK 623
CASA NINOS OF MONT/IN: CK 8996
MONT SCH OF MANHA REF:954
MONT SCH OF DOWNT REF:10136
THE MIAMI MONT SC REF:1070
RESTON MONT SCH REF:13926
DAKOTA MONT SCH REF:15069

What I want to extract is the following:

If there is a "CK" (check #), I want the number value in one column.
If there is a "REF:", I want the number value in another column.
As shown above, the numbers can be of varying length.
Can someone tell me how I can do this?

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 964
Default Extracting numbers from string of text

Assuming all of your data follows the same format as your examples, then
these formulas should work for you.

To extract the CK number:

=IF(ISERROR(FIND(" CK ",A1)),"",MID(A1,FIND(" CK ",A1)+4,1024))

To extract the REF number:

=IF(ISERROR(FIND("REF:",A2)),"",MID(A2,FIND("REF:" ,A2)+4,1024))

HTH,
Elkar


"Marie" wrote:

I am trying to extract numbers from a string of text. For example, the data
I have a

AMHERST /IN: CK 623
CASA NINOS OF MONT/IN: CK 8996
MONT SCH OF MANHA REF:954
MONT SCH OF DOWNT REF:10136
THE MIAMI MONT SC REF:1070
RESTON MONT SCH REF:13926
DAKOTA MONT SCH REF:15069

What I want to extract is the following:

If there is a "CK" (check #), I want the number value in one column.
If there is a "REF:", I want the number value in another column.
As shown above, the numbers can be of varying length.
Can someone tell me how I can do this?

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,718
Default Extracting numbers from string of text

In B1 =IF(ISNUMBER(SEARCH("CK",A1)),MID(A1,SEARCH("CK",A 1)+2,99),"")
In C1 =IF(ISNUMBER(SEARCH("REF",A1)),MID(A1,SEARCH("REF" ,A1)+4,99),"")

Copy down


"Marie" wrote:

I am trying to extract numbers from a string of text. For example, the data
I have a

AMHERST /IN: CK 623
CASA NINOS OF MONT/IN: CK 8996
MONT SCH OF MANHA REF:954
MONT SCH OF DOWNT REF:10136
THE MIAMI MONT SC REF:1070
RESTON MONT SCH REF:13926
DAKOTA MONT SCH REF:15069

What I want to extract is the following:

If there is a "CK" (check #), I want the number value in one column.
If there is a "REF:", I want the number value in another column.
As shown above, the numbers can be of varying length.
Can someone tell me how I can do this?

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
Extracting a word from a text string Nadeem Excel Discussion (Misc queries) 3 October 12th 06 09:17 AM
Extracting text from text string Emile Excel Worksheet Functions 3 March 30th 06 08:44 PM
extracting numbers from variable text JulianActon Excel Discussion (Misc queries) 8 November 7th 05 12:33 AM
Formulas dealing with text data Bagia Excel Worksheet Functions 6 June 20th 05 10:29 PM
extracting data from a text string of varying length andy from maine Excel Discussion (Misc queries) 4 March 28th 05 07:11 PM


All times are GMT +1. The time now is 08:54 PM.

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"