+ Reply to Thread
Results 1 to 6 of 6

Formula that will find the FIRST word from a list of words to appear in a cell?

  1. #1
    Registered User
    Join Date
    04-05-2012
    Location
    Southfield, Michigan
    MS-Off Ver
    Excel 2003
    Posts
    63

    Formula that will find the FIRST word from a list of words to appear in a cell?

    I have data dumped in cell A1. Raw text and some numbers.

    There is a range of words in Z1-Z10 that would trigger the identical action if found in A1.

    NOTE 1: It is entirely possible for several words from the Range in Col Z to be in A1.

    NOTE 2: It is entirely possible for those words to appear multiple times in A1.



    I need a formula that will find the FIRST INSTANCE OF ANY OF THE WORDS ON THE LIST.

    So, I don't need the first occurrence of each word. Just the first word in the Range to appear, period. "King of the Mountain" style here.

    I know I've done something similar to this before, but I am drawing a complete blank here...

    thanks,

    RJW

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,926

    Re: Formula that will find the FIRST word from a list of words to appear in a cell?

    Can you upload a small (clean) sample workbook (not a pic) of what you are working with, and what your expected outcome would look like.
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Registered User
    Join Date
    04-05-2012
    Location
    Southfield, Michigan
    MS-Off Ver
    Excel 2003
    Posts
    63

    Re: Formula that will find the FIRST word from a list of words to appear in a cell?

    Happily @FDibbins.

    Thanks for all of your help!

    RJ
    Attached Files Attached Files

  4. #4
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,926

    Re: Formula that will find the FIRST word from a list of words to appear in a cell?

    Based on your sample, I came up with this horrible ARRAY formula...
    =MID(A2,MIN(IFERROR(SEARCH($A$10:$A$17,A2),""))+LEN(INDEX($A$10:$A$17,MATCH(MID(A2,MIN(IFERROR(SEARCH($A$10:$A$17,A2),"")),4)&"*",$A$10:$A$17,0)))+2,9999)
    ...confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer. Press F2 on that cell and try again.

    Dont know what your real criteria looks like, but I took the 1st 4 letters of the 1st color found. If you need more than that, adjustthe BOLDED part

  5. #5
    Registered User
    Join Date
    04-05-2012
    Location
    Southfield, Michigan
    MS-Off Ver
    Excel 2003
    Posts
    63

    Re: Formula that will find the FIRST word from a list of words to appear in a cell?

    Hi FDibbins,

    And it's not horrible at all!

    I looked into this elsewhere but was naively hoping I could avoid the CTRL+SHIFT+ENTER solution because this will be used so often I would ideally like to see it self populate if you know what I mean. But it does work!

    Thanks for the help!

    rjw

  6. #6
    Forum Expert
    Join Date
    02-19-2013
    Location
    India
    MS-Off Ver
    07/16
    Posts
    2,386

    Re: Formula that will find the FIRST word from a list of words to appear in a cell?

    another approach may be
    =RIGHT(A2,LEN(A2)-FIND(" ",A2,MIN(IFERROR(SEARCH($A$10:$A$17,A2),FALSE))))
    with control shift and enter
    assuming your colour names will have space afterwards
    -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    WANT TO SAY THANKS, HIT ADD REPUTATION (*) AT THE BOTTOM LEFT CORNER OF THE POST

    More we learn about excel, more it shows us, how less we know about it.

    for chemistry
    https://www.youtube.com/c/chemistrybyshivaansh

+ 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: 05-19-2015, 03:03 PM
  2. Replies: 15
    Last Post: 05-28-2014, 05:57 AM
  3. [SOLVED] looking to find 1 of 2 words in a cell in column B and return the word found in the same
    By Rob69mfj in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-27-2014, 01:17 PM
  4. [SOLVED] Find if any words from a list appear in a cell
    By TheTattooedGuy in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-12-2013, 10:27 AM
  5. Replies: 3
    Last Post: 11-28-2012, 04:00 AM
  6. Replies: 1
    Last Post: 04-04-2012, 07:15 PM
  7. [SOLVED] Find and return a word, in a list of words, that is in a single cell.
    By nicholas.jacka in forum Excel General
    Replies: 2
    Last Post: 03-07-2012, 05:13 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