Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 184
Default Text parsing - Extracting data from inconsistent data entry format.

I have a column of data with inconsistent data entry format from which
I need to
extract the significant digits after the # sign.
I cannot simply use a Right function because the data I need to
extract is embedded in a text string..
FIND the # sign is only the beginning of the solution. But how do I go
from there ?
There is always a space between the last digit and the following
description text.
CO#002 Description text... Expected extraction : 2
CO# 005 xxxxxxxx... Expected extraction : 5
CO#0007 yyyyy... ... Expected extraction : 7
CO # 010 zzz.......... Expected extraction : 10
Help welcomed.

Celeste

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 284
Default Text parsing - Extracting data from inconsistent data entry format.

Celeste,

I think I'd use the split function a couple of times inside a user defined
function. Try something like:
____________________________

Function MyExtract(strIn As String) As Long
arrayA = Split(strIn, "#")
arrayB = Split(LTrim(arrayA(1)), " ")
MyExtract = CLng(arrayB(0))
End Function
_______________________________

Steve Yandl



"u473" wrote in message
ups.com...
I have a column of data with inconsistent data entry format from which
I need to
extract the significant digits after the # sign.
I cannot simply use a Right function because the data I need to
extract is embedded in a text string..
FIND the # sign is only the beginning of the solution. But how do I go
from there ?
There is always a space between the last digit and the following
description text.
CO#002 Description text... Expected extraction : 2
CO# 005 xxxxxxxx... Expected extraction : 5
CO#0007 yyyyy... ... Expected extraction : 7
CO # 010 zzz.......... Expected extraction : 10
Help welcomed.

Celeste



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,202
Default Text parsing - Extracting data from inconsistent data entry format.

I think I'd use the split function a couple of times inside a user defined
function. Try something like:
____________________________

Function MyExtract(strIn As String) As Long
arrayA = Split(strIn, "#")
arrayB = Split(LTrim(arrayA(1)), " ")
MyExtract = CLng(arrayB(0))
End Function
_______________________________


No need for the intermediate 'array' variables... you can combine it all
into one line:

Function MyExtract(strIn As String) As Long
MyExtract = CLng(Split(LTrim(Split(strIn, "#")(1)))(0))
End Function

Rick

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
text to columns with inconsistent data alignment Sarah Excel Discussion (Misc queries) 1 April 15th 09 08:48 AM
Data Entry Online, Data Format, Data Conversion and Data EntryServices through Data Entry Outsourcing [email protected] Excel Discussion (Misc queries) 0 March 20th 08 12:45 PM
saving text files and parsing data to spreadsheet priti Excel Programming 0 November 2nd 06 07:04 PM
format data displayed on Excel data entry form Bob, too Setting up and Configuration of Excel 0 May 19th 05 08:26 PM
Parsing Data with Formulas (vs Text-to-Columns) carl Excel Worksheet Functions 3 December 3rd 04 06:01 PM


All times are GMT +1. The time now is 12:32 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"