We help IT Professionals succeed at work.
Get Started

Excel VBA extracting value from a text string with inconsistent formatting

Last Modified: 2017-03-30
Hey Guys
Hope you can help
Is there a way to search within a text statement for part of the string that contains a number or specifically, in this case, a value?
We have a system that has a comments section and in this section, the user posts a comment (manually however the date is auto-created) that basically details payment approval, invoice reference with its quantity and value. This comments is then pulled from our system into an Excel worksheet against the relevant record.
My only issue is that the statement isn’t always consistent in terms of the formatting and spacing between each section, and although going forward, I have managed to standardise the way in which this has been posted, historically I need to extract certain data from these posts to assist in automating a linked process.
Please see some examples below taken from our system that shows the inconsistency in posting:-
09/06/2016 – Approved for payment         invoice number YC1564
      Pieces : 5416                                  Value : $57146,54

10/10/2016 – Approved for payment           invoice ref 1657/SS13
                 Pieces : 10142                                 Value : £4213.06

09/01/2017 – Approved for payment           Invoice no. 11312/JCB
                   Pieces : 500                                Value : 324.01 EUR

What I need is to extract the figure entered after the Value label (the currency etc is not an issue) – is this possible via a formula or VBA considering the format is not always the same? For example, for the first comment above, the result would be 57146.54.
If the whole comment is held in Cell A1 for example, what could I put into Cell P1 to extract this data? I have attached a really basic file to show how the comments is situated within the worksheet (albeit in a different location)
Your suggestions, as always, would be extremely welcome

Watch Question
Top Expert 2016
This problem has been solved!
Unlock 2 Answers and 3 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE