+ Reply to Thread
Results 1 to 14 of 14

Extracting prices from a string of text

  1. #1
    Registered User
    Join Date
    09-15-2009
    Location
    Leeds
    MS-Off Ver
    Excel 2000
    Posts
    27

    Extracting prices from a string of text

    If I have a string of text in cell A1 as follows...

    "Asfsdfsdf (£30) - 3 x gfgdfgfdgfdgf, £4.50 dgfdgfdg"

    ... Is it possible to extract the 2 prices (both preceded by "£"), add them together, and put the total in cell B1? (in this case resulting in £34.50 being displayed in cell B1)

    Issues that are making this formula tricky to work out as follows....
    - Sometimes the price has no decimal places and sometimes the price has 2 decimal places.
    - Sometimes the price is immediately followed by a closed bracket ")" rather than a space " ".
    - Sometimes there are other numbers in the string that aren't a price - in this case there is a number 3 in cell A1 which needs ignoring as it is not a price.

  2. #2
    Forum Contributor
    Join Date
    06-18-2007
    Location
    Kiama, Australia
    MS-Off Ver
    365
    Posts
    119

    Re: Extracting prices from a string of text

    Is a VBA solution acceptable?

  3. #3
    Forum Expert
    Join Date
    08-16-2015
    Location
    Antwerpen, Belgium
    MS-Off Ver
    2007-2016
    Posts
    2,380

    Re: Extracting prices from a string of text

    In case no Formula comes Up


    Please Login or Register  to view this content.
    Kind regards
    Leo

  4. #4
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Extracting prices from a string of text

    With formula
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    v A B
    1 Asfsdfsdf (£30) - 3 x gfgdfgfdgfdgf, £4.50 dgfdgfdg 34.5
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

  5. #5
    Forum Contributor
    Join Date
    06-18-2007
    Location
    Kiama, Australia
    MS-Off Ver
    365
    Posts
    119

    Re: Extracting prices from a string of text

    AlKey that's gold!

  6. #6
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 V 2503
    Posts
    13,702

    Re: Extracting prices from a string of text

    For formula solution.

    Formula: copy to clipboard
    Please Login or Register  to view this content.

    It assumes a lot.
    Last edited by FlameRetired; 09-07-2016 at 09:32 PM.
    Dave

  7. #7
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 V 2503
    Posts
    13,702

    Re: Extracting prices from a string of text

    Withdrawn. Double posted.
    Last edited by FlameRetired; 09-07-2016 at 09:33 PM.

  8. #8
    Registered User
    Join Date
    09-15-2009
    Location
    Leeds
    MS-Off Ver
    Excel 2000
    Posts
    27

    Re: Extracting prices from a string of text

    Quote Originally Posted by AlKey View Post
    With formula
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    v A B
    1 Asfsdfsdf (£30) - 3 x gfgdfgfdgfdgf, £4.50 dgfdgfdg 34.5
    Quote Originally Posted by FlameRetired View Post
    For formula solution.

    Formula: copy to clipboard
    Please Login or Register  to view this content.

    It assumes a lot.
    Thanks for the replies. These are both great and work perfectly with the string I provided "Asfsdfsdf (£30) - 3 x gfgdfgfdgfdgf, £4.50 dgfdgfdg".... However, I should have mentioned that sometimes there is only one price in the string and sometimes there are 3 prices in the string... eg."asfsad £5 sdfsdf" or "asdfsadf 3 ewewsafdaf £10 sadfdsf £3.30 sfdsfds 2 £7"

    Is there a formula that can do this for any number of prices in the string?

  9. #9
    Registered User
    Join Date
    09-15-2009
    Location
    Leeds
    MS-Off Ver
    Excel 2000
    Posts
    27

    Re: Extracting prices from a string of text

    Quote Originally Posted by LeoTaxi View Post
    In case no Formula comes Up


    Please Login or Register  to view this content.
    Kind regards
    Leo
    Thanks for this as well... I've just tested it and it's almost working perfectly, however, it seems to have problems with a few strings...

    Eg 1. "2 hours waiting time (£30)" = 288 but is should be 30
    Eg 2. "2 x Car Wash's = £10" = 286 but it should be 10
    Eg 3. "2hrs waiting (£30)" = 312 but it should be 30

  10. #10
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 V 2503
    Posts
    13,702

    Re: Extracting prices from a string of text

    loll_l,

    Is there room in the project for one or more helper columns? They can be hidden for aesthetic purposes. Output would likely not be in column B any longer.

  11. #11
    Registered User
    Join Date
    07-21-2015
    Location
    Earth
    MS-Off Ver
    2013
    Posts
    28

    Re: Extracting prices from a string of text

    As long as the price is preceeded by "£" sign.. the code below should match your request.

    Please Login or Register  to view this content.

  12. #12
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Extracting prices from a string of text

    Here is another way
    Enter formula in B1 and copy across and then down.
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    v A B C D E
    1 Asfsdfsdf (£30) - 3 x gfgdfgfdgfdgf, £4.50 dgfdgfdg £30.00 £4.50
    2 Asfsdfsdf (£30) - 3 x gfgdf(£25.6)gfdgfdgf, £4.50 dgfdgfdg £30.00 £25.60 £4.50
    3 Asfsdfsdf (£30) - 3 x gfgdf(£25.6)gfdgfd £5.75 gf, £4.50 dgfdgfdg £30.00 £25.60 £5.75 £4.50

  13. #13
    Registered User
    Join Date
    09-15-2009
    Location
    Leeds
    MS-Off Ver
    Excel 2000
    Posts
    27

    Re: Extracting prices from a string of text

    Quote Originally Posted by AlKey View Post
    Here is another way
    Enter formula in B1 and copy across and then down.
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    v A B C D E
    1 Asfsdfsdf (£30) - 3 x gfgdfgfdgfdgf, £4.50 dgfdgfdg £30.00 £4.50
    2 Asfsdfsdf (£30) - 3 x gfgdf(£25.6)gfdgfdgf, £4.50 dgfdgfdg £30.00 £25.60 £4.50
    3 Asfsdfsdf (£30) - 3 x gfgdf(£25.6)gfdgfd £5.75 gf, £4.50 dgfdgfdg £30.00 £25.60 £5.75 £4.50
    Awesome.... this does the job thanks very much..... thanks to everyone for your replies.

  14. #14
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 V 2503
    Posts
    13,702

    Re: Extracting prices from a string of text

    loll_l,

    You're welcome. Thanks for the feedback and the rep.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Extracting text value from string
    By dchubbock in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-20-2015, 07:56 AM
  2. Extracting text from a string
    By simonelvin in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 10-10-2014, 06:58 AM
  3. Extracting text from a string
    By AlexDeLara in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 02-26-2014, 04:41 AM
  4. Extracting numbers and text from inconsistent text/number formatted string
    By Brandivil in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-25-2013, 01:46 PM
  5. [SOLVED] Extracting latest prices from a price book with past and present prices
    By benoj2005 in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 08-10-2012, 04:08 AM
  6. [SOLVED] Extracting Text from a string of Text & Digits of variable length
    By hastex in forum Excel General
    Replies: 6
    Last Post: 06-06-2012, 09:11 AM
  7. Extracting the last name of a string of text
    By simjambra in forum Excel General
    Replies: 7
    Last Post: 05-15-2009, 11:04 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1