+ Reply to Thread
Results 1 to 3 of 3

Pulling all data left of a certain word surrounded by spaces

  1. #1
    Registered User
    Join Date
    06-27-2014
    Location
    USA
    MS-Off Ver
    2016
    Posts
    13

    Question Pulling all data left of a certain word surrounded by spaces

    Hi all,

    I'm trying to break down a list of meetings into separate columns with only the relevant information. I need to split Column A, which lists the company that sent a message and the one that received it, into two separate columns--one for the "from" company and one for the "to" company. Column A has a standard format of "COMPANYANAME to COMPANYBNAME." The problem is that I can't figure out how to make Excel split around the word "to." I've tried a combination of LEFT/LEN/SEARCH to get a rough list, but there are quite a few discrepancies. Any recommendations on how to make the text that comes before "to" appear in one separate column? I got the company that receives the message by using =RIGHT(C2,LEN(C2)-2) but the non-breaking spaces are giving me trouble for the company that sent the message.

    Example...there are many cells in Column A with data formatted like the below
    ABC Company to Mega Corporation, Inc.
    or
    WallyMart Co. to River Company, Ltd.

    I want to rip the "ABC Company" and "WallyMart Co." into a separate cell.

    Thanks!

  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 2403
    Posts
    44,053

    Re: Pulling all data left of a certain word surrounded by spaces

    Try this:

    TRIM(MID(SUBSTITUTE("to"&$A1,"to",REPT(" ",125)),125*COLUMNS($A:A),125))

    Copy across.
    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.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  3. #3
    Registered User
    Join Date
    06-27-2014
    Location
    USA
    MS-Off Ver
    2016
    Posts
    13

    Re: Pulling all data left of a certain word surrounded by spaces

    Hi Glenn,

    Thanks for the quick response! I've just tried that formula and it has a similar problem as the one I was using previously in that it will remove the data after "to" anywhere in the cell. Any company that has "to" in their name somewhere -- like Mitotech -- ends up with missing data. Is there a way to capture the spaces around the "to" so that Excel will only look for " to "? I inserted CHAR(160) in there to no avail. 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. Pulling Value to the Left of Data with 2 Constraint
    By Roadstr48 in forum Excel General
    Replies: 5
    Last Post: 07-31-2015, 04:54 PM
  2. [SOLVED] Need to make button to move data in calendar 5 spaces to left
    By jstoffle in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 03-12-2015, 02:21 PM
  3. [SOLVED] Word pulling data from Excel: For-Each loop on read input
    By Phixer in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-09-2014, 04:19 PM
  4. Replies: 1
    Last Post: 04-04-2012, 11:14 PM
  5. using left command, 3 spaces over
    By vascott01 in forum Excel General
    Replies: 4
    Last Post: 04-07-2010, 02:45 PM
  6. Pulling data from a sheet into Word in a specific order
    By schallpattern in forum Excel General
    Replies: 0
    Last Post: 06-09-2009, 03:29 PM
  7. Word userform pulling data from Excel
    By Freaky_zoid in forum Word Programming / VBA / Macros
    Replies: 3
    Last Post: 04-02-2009, 05:38 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