+ Reply to Thread
Results 1 to 11 of 11

Stripping Keywords out of a text string and placing into relevant columns

  1. #1
    Registered User
    Join Date
    12-26-2012
    Location
    Houston
    MS-Off Ver
    Excel 2007
    Posts
    24

    Stripping Keywords out of a text string and placing into relevant columns

    I want to take a text string, in this case a broker confirm for trading, and find Volume, direction of the deal (buy sell), counterparty (trading shop selling/buying from me). And place them in a format where these pieces of information are contained in their respective columns:

    ABC Inc. Sell, XYZ Inc. Buy 25 Contracts of Oil Futures for September at 45 (dollars)


    A B C D E F
    Buy Sell Product Volume Delivery Price
    ABC Inc. XYZ Inc. Oil Futures 25 September 45

    The confirms have the same structure typically "Company A" buys, "Company B" sells, "volume" "Product" for "Delivery" at "Price"...

    Any help would be very appreciated!!!!

  2. #2
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: Stripping Keywords out of a text string and placing into relevant columns

    I would be very surprised if ONE example will be representative of your real data. Please upload a sample sheet with about 10 strings.

    Remember to remove ALL confidential information first!!!

    However, nothing on this Forum works quite as well as you might expect. The attachment icon doesn't work!! (Helpful, isn't it!!). Instead, just before you submit your post, click on GO ADVANCED (near the bottom) and then scroll down to Manage Attachments to open the upload window. The relevant instructions are at the top of that screen.
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU

  3. #3
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: Stripping Keywords out of a text string and placing into relevant columns

    I have had an initial bash at doing this, in the absence of more data. It's a start...
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    12-26-2012
    Location
    Houston
    MS-Off Ver
    Excel 2007
    Posts
    24

    Re: Stripping Keywords out of a text string and placing into relevant columns

    Here is an example and what I would like to see... it may be too involved, but being able to parse quickly and efficiently would be great....
    Attached Files Attached Files

  5. #5
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: Stripping Keywords out of a text string and placing into relevant columns

    Mmmm. Your single example was FAR from being representative. This seems to work for your examples.
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    12-26-2012
    Location
    Houston
    MS-Off Ver
    Excel 2007
    Posts
    24

    Re: Stripping Keywords out of a text string and placing into relevant columns

    How bout we take it in another direction... for counterparty and product, is there a simple way to find if a text string contains a keyword found in a list of keywords... i.e. I only trade with about 20 counterparties and only trade rougly 7 products...

  7. #7
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: Stripping Keywords out of a text string and placing into relevant columns

    First things first. Did the file attached above do what you had expected?

    In what way did it not work?

    What strings from your real data did it NOT work with?

    As far as your last post is concerned, without seeing REPRESENTATIVE sample data, I haven't a clue what you're talking about. However, before ditching a considerable amount of fiddling around getting something that seemed to work with your representative data, I'd like to know where it fell over.

  8. #8
    Registered User
    Join Date
    12-26-2012
    Location
    Houston
    MS-Off Ver
    Excel 2007
    Posts
    24

    Re: Stripping Keywords out of a text string and placing into relevant columns

    Sorry to have offended you/wasted your time... but what I'm finding is that your solution is quite constrained i.e. these are Instant messages and sometimes their formats vary... I've found that using a series of dynamic named ranges, search functions and if statements is working quite nicely for the the confirms. I realize my example may have not been REPRESENTATIVE enough, so I apologize. Now I have only two more variables I would like to parse out and I'm guessing the solution will be pretty easy. First is the "Volume" is a number followed by *mb (thousand barrels) or very rarely just a *k for thousand. Is there a way to find a number attached to either of these "suffixes" and return the number? example: Sean sells 25mb of frog oil, Luke buys... = 25. The second issue is price and may be a bit more involved and like I said the formula has to be dynamic in that it may have to find different formats. The example below are actual confirms and you can see their varying formats:

    1:39:33 pm Sean sells 10mb of oct frog oil ice block futs at 97.625 = Expected result - 97.625
    (ICE) Sean Sell, Karen Buy, 5mb Sep Whale Oil #5 65.50 = Expected result - 65.50
    (Direct) Sean Buy, Oliver Sell 25mb Sep Horse Oil #4 96.25 = Expected Result - 96.25

    I worry that if the time stamps come across as numbers they will be pulled as the pricing result, or the grade (in this case #5 and #4) will also bring about a false result.... Hopefully this is an easier fix than I'm imagining. thank you for your time.

  9. #9
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: Stripping Keywords out of a text string and placing into relevant columns

    Annoyed by the lack of explanation, rather than by the failure of the answer!!

    The times at the start can pose a problem, as can k (as opposed to kb), as this causes problems with other k-strings (Karen, block, etc). Eventually, i resorted to brute force and ignorance which works for all my examples.

    The last number is easy. I added in one extra step, as there was a CHAR(160) at the end of one of your earlier examples. Try this:
    Attached Files Attached Files

  10. #10
    Registered User
    Join Date
    12-26-2012
    Location
    Houston
    MS-Off Ver
    Excel 2007
    Posts
    24

    Re: Stripping Keywords out of a text string and placing into relevant columns

    Boom that worked like a charm! thanks for your patience and help!!!

  11. #11
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: Stripping Keywords out of a text string and placing into relevant columns

    Thanks for the feedback. Rep appreciated, too...
    Last edited by Glenn Kennedy; 09-12-2016 at 02:58 PM.

+ 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. Replies: 2
    Last Post: 03-08-2015, 09:31 AM
  2. [SOLVED] Stripping Numbers from Text String.
    By JRidge in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-05-2014, 05:20 AM
  3. Replies: 0
    Last Post: 07-11-2012, 06:05 AM
  4. [SOLVED] find word(s) within text string that matches a list of keywords
    By ecc34_11 in forum Excel General
    Replies: 10
    Last Post: 07-11-2012, 06:04 AM
  5. [SOLVED] Using a discrete range of keywords, search a text string for match
    By Ian99 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-24-2012, 11:40 AM
  6. [SOLVED] find first word within text string that matches from a list of keywords
    By exclusivebiz in forum Excel General
    Replies: 5
    Last Post: 04-13-2012, 03:29 PM
  7. [SOLVED] Add numbers accross columns after stripping away text
    By gavin in forum Excel General
    Replies: 10
    Last Post: 05-23-2005, 03: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