+ Reply to Thread
Results 1 to 4 of 4

If contains text statements that return text string

  1. #1
    Registered User
    Join Date
    10-29-2014
    Location
    London
    MS-Off Ver
    Office 2013
    Posts
    2

    If contains text statements that return text string

    I want to create a formula that will check a text string in one cell and then return the relevant label in the row where the formula is entered.
    So, for example, if a cell contains the text 'chicken' then 'chicken' is returned in the formula cell - but i need to do this for about 10 - 15 different matches against 1 column.

    So if it contains 'chicken', then return 'chicken', if it contains 'apple' then return 'apple', if it contains 'pear' then return 'pear' etc.

    I have tried to do this with a nested if/search statement but it would only match two different criteria for it stopped working.

    Help!

    Thanks

  2. #2
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: If contains text statements that return text string

    You could use a small UDF:
    Please Login or Register  to view this content.
    Use as
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    The first argument = a comma separated list of values you want to check for
    The second argument = the text to check
    The (optional) third argument = set TRUE to ignore case, FALSE (or omitted) to match case.
    let Source = #table({"Question","Thread", "User"},{{"Answered","Mark Solved", "Add Reputation"}}) in Source

    If I give you Power Query (Get & Transform Data) code, and you don't know what to do with it, then CLICK HERE

    Walking the tightrope between genius and eejit...

  3. #3
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: If contains text statements that return text string


    A
    1
    Abc xyz
    2
    xyz Chicken
    3
    Def IJK
    4
    Lef Apple def
    5
    yjk lek pear



    D
    1
    Chicken
    2
    Apple
    3
    Pear


    In B1 Cell

    =IFERROR(LOOKUP(2,1/SEARCH($D$1:$D$3,A1),$D$1:$D$3),"Not Found In List")

    Drag it down...


    B
    1
    =IFERROR(LOOKUP(2,1/SEARCH($D$1:$D$3,A1),$D$1:$D$3),"Not Found In List")



    B
    1
    Not Found In List
    2
    Chicken
    3
    Not Found In List
    4
    Apple
    5
    Pear


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  4. #4
    Registered User
    Join Date
    10-29-2014
    Location
    London
    MS-Off Ver
    Office 2013
    Posts
    2

    Re: If contains text statements that return text string

    Thanks Olly, that is really useful - but unfortunately I reached a character count limit for the query that I need. Is there a way to extend it?

    6thsense - I tried your formula but couldn't get it to work, probably need a bit more of a description of what it is doing to understand it fully. I was thinking that a lookup could be good, but i'd like to do it from a separate sheet with all of the required fields, how would I do that?

    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. Formula to find and return text string within a cell full of text strings
    By LightingPop in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-03-2013, 11:45 PM
  2. [SOLVED] Find partial text string within another text string return original text into cell.
    By mikey42979 in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 06-17-2013, 02:58 PM
  3. [SOLVED] Nested IF statements to FIND text string and return set values.
    By stuartm4h in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-12-2013, 12:03 PM
  4. [SOLVED] Find Specific Text in Text String and Return Value in Adjacent Column
    By watchouse in forum Excel General
    Replies: 2
    Last Post: 07-11-2012, 03:53 PM
  5. Search text string for range of text values - return match
    By crugg in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-03-2010, 09:55 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