+ Reply to Thread
Results 1 to 4 of 4

Can I extract numbers from a text string (of varying lengths) and use them?

  1. #1
    Registered User
    Join Date
    05-09-2012
    Location
    Leeds
    MS-Off Ver
    Excel 2010
    Posts
    1

    Can I extract numbers from a text string (of varying lengths) and use them?

    Hello everyone,

    I don't know much about the amazing things excel is capable of but I do know it is bloody clever so I think it is possible to do what I want to do and was wondering if anyone on here knew how to do it. So I have the following information in a column:

    2 No FCUs x 6.7 kW
    2 No FCUs x 6.7 kW
    2 No FCUs x 6.7 kW
    4 No FCUs x 6.7 kW
    1 No FCU x 3.42 kW
    1 No FCU x 3.42 kW

    These numbers represent the number of Fan Coil Units in a room and the maximum cooling capacity of each one. In the adjoining column I would like the calculate the total cooling power in the room, so for the first example it would be 2*6.7 kW = 13.4 kW.

    Now obviously, that is easy enough to do manually but there are quite a few rows of this type of thing and I have already had to change all the powers once and manually re-calculate the total power in the room. I also know that it would be easy to split this into 2 columns, one with the number of units and one with the power of each unit and work it out easily that way. But someone else set the spreadsheet up as it is in that format and I am curious to know whether it is possible to write a formula that will extract the "No of units" figure and the "power" figure, convert them to numbers and then multiply them to give me my total. That way, any modifications to the column would automatically update the total. From my own research into it it seems possible if you can specify the location of the number you want to extract, but in this case that varies depending on whether there is 1 or more than 1 FCU as if there is more than 1 you have an "s" which adds a character to the text string.

    Like I have said, it is not important that I work out how to do this, I am just curious as to whether it is possible and how you would do it if so. So if anyone knows the answer and has the time then it would be much appreciated!

    Thanks

  2. #2
    Valued Forum Contributor
    Join Date
    03-16-2012
    Location
    Aarhus, Denmark
    MS-Off Ver
    Excel 2007
    Posts
    992

    Re: Can I extract numbers from a text string (of varying lengths) and use them?

    Assuming your data starts in A1, then try this in B1:

    =LEFT(A1;1)*MID(A1;FIND("x";A1)+2;FIND(" ";A1;FIND("x";A1)+2)-FIND("x";A1)-2) and copy down. You may have to change ; to , depending on your delimiters.
    Sincerely
    S?ren Larsen

    "Give a man a fish, and you'll feed him for a day. Give a man a fishing rod, and he'll steal your yacht!"

  3. #3
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Can I extract numbers from a text string (of varying lengths) and use them?

    It might be better to allow for more than 9 units, try
    Please Login or Register  to view this content.
    Then you could format the cells
    Format cells ... Number Format > Custom
    Type:=
    Please Login or Register  to view this content.
    If you need any more information, please feel free to ask.

    However,If this takes care of your needs, please select Thread Tools from menu above and set this topic to SOLVED. It helps everybody! ....

    Also
    اس کی مدد کرتا ہے اگر
    شکریہ کہنے کے لئے سٹار کلک کریں
    If you are satisfied by any members response to your problem please consider using the small Star icon bottom left of their post to show your appreciation.

  4. #4
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Can I extract numbers from a text string (of varying lengths) and use them?

    How about
    =LEFT(A1,FIND(" ",A1)-1)*SUBSTITUTE(MID(A1,FIND("x",A1)+2,50)," kW","")

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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