+ Reply to Thread
Results 1 to 3 of 3

Text to columns separated by "-" using formulas

  1. #1
    Registered User
    Join Date
    04-20-2013
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    7

    Text to columns separated by "-" using formulas

    Hi,

    Please see the attached spreadsheet.

    I basically have 3 or 4 words separated by "-" in one cell.

    In this example, I used the words Beg-Mid-End-End and Beg-End-End

    I want to separate them to 3 different columns: Beg, Mid, and End-End.

    I want create a formula, where the excel sheet could recognize when there is no "Mid", the cell should be blank, and the "End-End" should be together in the third column.

    The formula I created (found online actually...haha) works well when there are 4 words but not work when there are 3 words. Please see the attached spreadsheet to see where I'm stuck and what I desire.

    Again, when I drag down the formula for the Mid it should be blank when there are 3 words, and the End-End should be together on the last column.Thank you for your help!
    Attached Files Attached Files

  2. #2
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,863

    Re: Text to columns separated by "-" using formulas

    Enhanced formulas (row 2 and copy down):
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    and
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Best Regards,

    Kaper

  3. #3
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2024
    Posts
    6,175

    Re: Text to columns separated by "-" using formulas

    Try this ...

    C2:

    =IF(COUNTIF(A2,"*Mid*")=0,"",TRIM(MID(SUBSTITUTE(A2,"-",REPT(" ",200)),200,200)))

    D2:

    =RIGHT(A2,LEN(A2)-LEN(B2&C2)-1-(C2<>""))

+ 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: 5
    Last Post: 02-05-2019, 12:03 AM
  2. [SOLVED] Text strings separated with "/", ",", "-" or "&"
    By alice2011 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-27-2015, 02:13 PM
  3. Replies: 1
    Last Post: 08-15-2014, 06:00 AM
  4. [SOLVED] formula for "if a cell contain text" wen looking for 2 separated strings
    By Tamar81 in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 12-11-2013, 01:59 AM
  5. [SOLVED] How to check two columns for the presence of text and returning "yes" or "no"
    By Karelia Suite in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 03-19-2013, 09:36 AM
  6. Replies: 0
    Last Post: 01-09-2013, 06:52 PM
  7. How can i copy value from "HTMLText"(EMBED("Forms.HTML:Text","")),using Macro
    By andrewyang in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-18-2010, 12:47 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