+ Reply to Thread
Results 1 to 6 of 6

Converting string containing numbers and text to currency and text

  1. #1
    Forum Contributor
    Join Date
    04-13-2006
    Location
    London
    Posts
    102

    Question Converting string containing numbers and text to currency and text

    I have a string with numbers and text and I want to convert the number element to currency and retain the text.

    For example:

    Please Login or Register  to view this content.
    Needs to become:

    Please Login or Register  to view this content.
    Is there any easy/short way to do this?

    Thanks for any help in advance!

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,731

    Re: Converting string containing numbers and text to currency and text

    If your data is in A1, you can use this formula (e.g. in B1):

    =TEXT(--LEFT(A1,FIND(" ",A1)-1),"£#,##0") & RIGHT(A1,LEN(A1)-FIND(" ",A1)+1)

    Hope this helps.

    Pete

  3. #3
    Forum Contributor
    Join Date
    04-13-2006
    Location
    London
    Posts
    102

    Re: Converting string containing numbers and text to currency and text

    Thanks Pete - the data is actually assigned to a string variable name inside VBA but I'm sure I could adapt your technique with a bit of fiddling. Cheers.

  4. #4
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,064

    Re: Converting string containing numbers and text to currency and text

    Your solitary example implies every amount is going to be followed by " (approx)" since you havent providied any variation of that pattern.
    Hence this should work

    =TEXT(LEFT(A1,FIND(" ",A1)-1),"£0 (approx)")
    Regards
    Special-K

    Ensure you describe your problem clearly, I have little time available to solve these problems and do not appreciate numerous changes to them.

  5. #5
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Converting string containing numbers and text to currency and text

    Hi,

    If the numbers are always at the beginning of the string you might use
    Please Login or Register  to view this content.
    Last edited by xlnitwit; 10-06-2016 at 06:49 AM.
    Don
    Please remember to mark your thread 'Solved' when appropriate.

  6. #6
    Forum Contributor
    Join Date
    04-13-2006
    Location
    London
    Posts
    102

    Re: Converting string containing numbers and text to currency and text

    Thanks for all the responses!

    xlnitwit's was perfect for what I needed - thanks!

+ 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] UDF or similar to extract currency amounts or numbers and symbols from text string
    By jyadayada in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-05-2016, 05:52 PM
  2. Replies: 7
    Last Post: 11-06-2014, 04:57 AM
  3. Replies: 2
    Last Post: 10-16-2014, 05:45 AM
  4. Converting Text to Currency
    By madaboutgolf in forum Excel General
    Replies: 2
    Last Post: 10-28-2011, 02:26 AM
  5. Excel 2007 : Converting Currency figures to Text
    By harivunnava in forum Excel General
    Replies: 1
    Last Post: 03-11-2010, 02:05 PM
  6. Converting Text String to Separate Numbers
    By Cincy in forum Excel General
    Replies: 1
    Last Post: 06-07-2006, 05:30 AM
  7. converting numbers to text and prefill text field with 0's
    By Jan Buckley in forum Excel General
    Replies: 2
    Last Post: 01-20-2005, 05:06 PM

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