EXTRACTING / PARSING DATA OUT OF A TEXT OR CSV FILE

Hi Experts

We receive somewhere between 200 and 1000 text messages everyday from GSM modems located all over the country (South Africa). These messages are captured into an SMS management program which allows the exporting of these messages into Microsoft Excel format.

The SMS messages that are received all have the same format except for the length of the currency value:

FldFrom --> +27823807449
FldTo --> always blank
FldDateTime  --> 13.11.2004 16:49
FldDescription --> irrelevant information
FldText --> &KGWT: 1734350,0,0,0□□□□OK  

The "□" symbol in the FldText field represents the ENTER key. i.e the messages are  displayed as follows:

&KGWT: 1734350,0,0,0



OK

- - - - - - - - - - -
A sample of this .xls file can be downloaded from: http://www.kobweb.co.za/dev/txtautomation.xls
- - - - - - - - - -

We need to import these text messages into an Access database. However we need to filter this data and only import the following data in the following format:

MessageNumber                      (Autonumber generated by access)
MobileNumber: 27823807449    (without the preceeding + sign)
MessageDate:  13/11/2004       (Short Date format - dd/mm/yyyy)
MessageData:  17,343.50         (currency value with 2 decimal places - value will always be .00 or .50)

- - - - - - - - - - -
To parse/extract the MobileNumber was simple (we merely used =Right([FldFrom],11)
To parse/extract the MessageDate was simple (we merely set the Format of the field to dd/mm/yyyy)

However, we cannot seem to parse out only the MessageData currency value - 17,343.50.
* In everycase the currency value starts 7 characters from the left
* In everycase the FldText end with 6 characters of useless info

All we need is a way to parse/extract out only the characters starting at character number 7 and ending 6 characters from the end of the field.

We have tried all different versions of Left, Right and Mid, but cannot find a solution.

Anyone offering a quick and easy method that will allow us to import only the relevant data we need (in the correct formats) will be awarded top points.

Thx Experts!

StanKobrin


StanKobrinAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

RichardCorrieCommented:
try

Amount=cdbl(mid(FldText,7,instr(7,FldText,",")-6))/100
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
StanKobrinAuthor Commented:
Hi Richard

That worked absolutely perfectly. All I did was then convert the field to Currency and i'm up and running.

Points well deserved.

Stan
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.