+ Reply to Thread
Results 1 to 4 of 4

Extract text before the first instance of period or hyphen

  1. #1
    Registered User
    Join Date
    03-28-2017
    Location
    New York, New York
    MS-Off Ver
    2010
    Posts
    20

    Extract text before the first instance of period or hyphen

    Hi,

    I am trying to come up with a formula that extracts text before the first instance of any one of three symbols: period, hyphen, and forward slash.
    So far I have the below formula which can only handle looking for one of the three symbols at a time.

    =IF(AND((A2="Germany"),IFERROR(FIND("-",B2)>0,FALSE)),LEFT(B2,MIN(FIND("-",B2))-1))

    What I need is a formula that will give me the output in column C of the image below.
    Any assistance would be great.

    Data.png

  2. #2
    Forum Contributor
    Join Date
    07-13-2015
    Location
    Quebec, Canada
    MS-Off Ver
    2013
    Posts
    232

    Re: Extract text before the first instance of period or hyphen

    There's likely a better way but this should work


    Please Login or Register  to view this content.

  3. #3
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,228

    Re: Extract text before the first instance of period or hyphen

    Hi,

    See if this does what you need:

    Please Login or Register  to view this content.
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  4. #4
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Extract text before the first instance of period or hyphen

    Try this
    Enter formula in C2 and copy down
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    v A B C
    1 Employee location Employee id Output
    2 Germany NYHJ-BW.7 NYHJ
    3 Germany GEJ.AP-12 GEJ
    4 Germany SPJ/LK-84 SPJ
    5 Mexico POLSC/LK-7.SW 0
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

+ 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] Trying to extract text cells at the first instance of four consecutive numbers
    By portokie in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 07-15-2016, 06:32 PM
  2. [SOLVED] Extract all text from right until first instance of symbol
    By Daedra in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-19-2015, 06:28 AM
  3. [SOLVED] Extract numbers before first instance of text
    By pauldaddyadams in forum Excel General
    Replies: 5
    Last Post: 08-12-2014, 07:34 AM
  4. [SOLVED] Extract all text to the left of a hyphen ???
    By burdo77 in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 03-06-2014, 03:54 AM
  5. Extract text right after period
    By DaronneBonneau in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-04-2013, 11:40 AM
  6. Replies: 2
    Last Post: 08-06-2011, 11:15 AM
  7. How to Extract Text Before Second Instance of a Symbol
    By lionsdeal in forum Excel General
    Replies: 2
    Last Post: 08-04-2009, 02:28 PM

Tags for this Thread

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