+ Reply to Thread
Results 1 to 6 of 6

Copy value after second blank space

  1. #1
    Registered User
    Join Date
    08-18-2010
    Location
    Belo Horizonte, Brasil
    MS-Off Ver
    Excel 2007
    Posts
    12

    Copy value after second blank space

    Hi i need to search a cell and copy everything after the second blank character until ;. Heres an example:
    R31_ELP_BBHID02.EFUNC := FALSE;
    i need to extract the word "false" but the datas are very generic and not its always named "false" but its always is between " " and ";" (a second blank space and a . Any sugestions?
    Thank you

  2. #2
    Forum Expert
    Join Date
    07-16-2010
    Location
    Northumberland, UK
    MS-Off Ver
    Excel 2007 (home), Excel 2010 (work)
    Posts
    3,054

    Re: Copy value after second blank space

    If there will always be two spaces and one semi-colon in your text then you can use a simple formula:

    Please Login or Register  to view this content.

    Edited to add: Does the ":=" always appear, it would be much simpler to look for that.

  3. #3
    Registered User
    Join Date
    08-18-2010
    Location
    Belo Horizonte, Brasil
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: Copy value after second blank space

    Sry but it does not seem to be working, maybe im doing something wrong.
    Im clicking the b1 cell and pasting the formula but it says its not working or theres something wrong.
    And no i cant consider the use of " := " couse it maybe just the " : ".

    R31_UDV_VBYPS30_MFAUT := FALSE;
    R3D1_VDV_CLSUP01D_EINT12 : BOOL ;
    R31_BDV_FT0655_EFQ : REAL ;

    Those are the kind of data i have. In those cases i need false, bool and real. Thanks again.

    Edit: got the formula to work but it shows "#N/D" on the b1 column
    Last edited by Rodrigo Rocha; 08-24-2010 at 07:10 PM.

  4. #4
    Forum Expert
    Join Date
    07-16-2010
    Location
    Northumberland, UK
    MS-Off Ver
    Excel 2007 (home), Excel 2010 (work)
    Posts
    3,054

    Re: Copy value after second blank space

    If I paste your three examples into cells A1-A3 then put my formula into cell B1 and drag it down I get the responses:

    "FALSE"
    "BOOL "
    "REAL "

    Are you pointing the formula at the right cells? You'll have to change all of the references to A1 to the cell where your data actually is.

  5. #5
    Registered User
    Join Date
    08-18-2010
    Location
    Belo Horizonte, Brasil
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: Copy value after second blank space

    It worked finally, it was some stuff i was doing wrong, thank you. But do you know how to use it in a macro? Like a macro that does the same thing? thank you

  6. #6
    Forum Expert
    Join Date
    07-16-2010
    Location
    Northumberland, UK
    MS-Off Ver
    Excel 2007 (home), Excel 2010 (work)
    Posts
    3,054

    Re: Copy value after second blank space

    It depends how you want the macro to work.

    You could write a UDF (User-Defined Function) which would let you use a worksheet formula to call a custom block of code.

    Alternatively you could write a macro to churn through a whole range of data (everything in a column, say) and return the value. Or you could write a macro which calls a UDF. The options are virtually endless.

    Try the following code...

    Please Login or Register  to view this content.
    This starts with row 1 in column 1 on the currently active sheet and loops through column A until it finds a blank, for each entry it puts the return value that you want into column 2. Is that the sort of thing you were looking for?

    Generally using worksheet functions is faster than running a macro, but if the data is going to be static once it's in Excel then there's no real issue with using VBA to do the job.

+ 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