+ Reply to Thread
Results 1 to 10 of 10

If formula for text before and after a semi colon

  1. #1
    Registered User
    Join Date
    04-21-2015
    Location
    DC
    MS-Off Ver
    Office 2010
    Posts
    4

    If formula for text before and after a semi colon

    Hi, we have a cell of data from a multi select picklist (the first word is the primary and the second word is the secondary):

    For example

    Apple; Banana

    We need to have 2 columns for primary and secondary.

    Is there a way to use a formula to capture the first word before the semi colon and populate the new cell? And then for the word after the semi colon for the new cell in the next column.

    Thanks,

    Charles

  2. #2
    Valued Forum Contributor
    Join Date
    05-07-2014
    Location
    India
    MS-Off Ver
    MS Office 365
    Posts
    313

    Re: If formula for text before and after a semi colon

    Hi Charle,

    Welcome to the excel forum...

    Assuming you will have only 2 type of category and you have 'Apple; Banana' in cell A1. So use the following function in B1 & C1 to get the desired result

    =LEFT(A1,SEARCH(";",A1,1)-1) ---- will return Apple
    =RIGHT(A1,SEARCH(";",A1,1)) ---- will return Banana

    Let me know if you are looking for the same and it helps you.
    Thanks
    Nisha Dhawan


    If you like my answer please click on * Add Reputation
    "If you can dream it, You can do it "

  3. #3
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: If formula for text before and after a semi colon

    Using a formula...

    A2 = Apple; Banana

    Enter this formula in B2:

    =IF(A2="","",LEFT(A2,FIND(";",A2)-1))

    Enter this formula in C2:

    =MID(A2,LEN(B2)+3,20)
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  4. #4
    Registered User
    Join Date
    04-21-2015
    Location
    DC
    MS-Off Ver
    Office 2010
    Posts
    4

    Re: If formula for text before and after a semi colon

    Sorry, I should have clarified, there are about 40 different "categories" types of fruit. They can choose either 1 fruit, or any two.

  5. #5
    Valued Forum Contributor
    Join Date
    05-07-2014
    Location
    India
    MS-Off Ver
    MS Office 365
    Posts
    313

    Re: If formula for text before and after a semi colon

    So how will they decide that which one or two has to pick?

  6. #6
    Registered User
    Join Date
    04-21-2015
    Location
    DC
    MS-Off Ver
    Office 2010
    Posts
    4

    Re: If formula for text before and after a semi colon

    The one that is before the semi colon is the primary topic, the one after the semi colon is the secondary topic. If there is only 1, then it is the primary topic be default.

  7. #7
    Valued Forum Contributor
    Join Date
    05-07-2014
    Location
    India
    MS-Off Ver
    MS Office 365
    Posts
    313

    Re: If formula for text before and after a semi colon

    So in that case, can you try the above given functions once. It seems they will meet your criteria.

  8. #8
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: If formula for text before and after a semi colon

    Quote Originally Posted by charlesonmission View Post
    sorry, i should have clarified, there are about 40 different "categories" types of fruit. They can choose either 1 fruit, or any two.
    OK, try these...

    B2:

    =IF(COUNT(FIND(";",A2)),LEFT(A2,FIND(";",A2)-1),T(A2))

    C2:

    =MID(A2,LEN(B2)+3,20)

  9. #9
    Registered User
    Join Date
    04-21-2015
    Location
    DC
    MS-Off Ver
    Office 2010
    Posts
    4

    Re: If formula for text before and after a semi colon

    That did it, thanks Tony!

  10. #10
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: If formula for text before and after a semi colon

    You're welcome. Thanks for the feedback!

+ 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. [SOLVED] Semi-colon Delimited String Contains Text Occuring in Column
    By The831st in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-04-2014, 06:28 AM
  2. Separating semi-colon between numbers.
    By ae.chun in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-10-2013, 10:42 PM
  3. Remove semi-colon delimiter from import-text code
    By ron2k_1 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-17-2011, 11:20 AM
  4. Strip Excess Semi-Colon from Text File
    By erock24 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-29-2011, 01:30 PM
  5. How to add semi colon : ?
    By OceanBlue in forum Excel General
    Replies: 4
    Last Post: 04-27-2011, 08:25 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