+ Reply to Thread
Results 1 to 5 of 5

Return text within a text cell

  1. #1
    Registered User
    Join Date
    06-13-2017
    Location
    London, England
    MS-Off Ver
    2010
    Posts
    10

    Return text within a text cell

    Hi, I'm stuck. I need excel to check if a cell has the text in A20 (let's say it's "Asc"), and for it to check the array of A1:A:10.
    Now, the Asc sometimes will appear on it's own and this is easy, but often it will appear in a similar way as below (i.e. as parts of several text strings within the cell), but each time it will be different (sometimes it will be third word, sometimes forth, sometimes first like below, etc). So, I can not use left,right,mid functions either as I dont know when it will appear in what position.

    MATCH doesn't work, as it only works if in the cell we only have Asc, if we have more strings (like below) then it doesn't work.

    ----------example----------------
    A1: Asc Ke Ra Ma
    A2: Sa Ve
    A3: Mo
    A4: ... etc
    --------------------------------

    So, how do I do it?

    I need it, so that I can then make excel return me an index value in a next cell from where the Asc was found (I know how to do that part with index function)

    Any help?

  2. #2
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,612

    Re: Return text within a text cell

    (How to) Upload a Workbook directly to the Forum
    (please do not post pictures or links to worksheets)
    • Click Advanced next to Quick Post button at the bottom right of the editor box.
    • Scroll down until you see "Manage Attachments",
    • Click the "Choose" button at the upper left (upload from your computer).
    • Select your file, click "open", click "upload"
    • Once the upload is completed the file name will appear below the input boxes in this window.
    • Close the Attachment Manager window.
    • Click "Submit Reply"
    Note: Please do not attach password protected workbooks/worksheets
    Ensure to disable any Workbook Open/Autorun macros before attaching!
    Ben Van Johnson

  3. #3
    Forum Contributor
    Join Date
    08-29-2012
    Location
    Slough
    MS-Off Ver
    Excel 2007
    Posts
    469

    Re: Return text within a text cell

    Niko_tds,

    I think you can use something along the lines of:

    =IF(ISNUMBER(FIND("ASC",A20)),"TRUE","FALSE")

    and then have the index formula in the true part.

    EDIT: THis is a case sensitive search though.
    Last edited by DannyJ; 06-15-2017 at 04:48 AM.

  4. #4
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,732

    Re: Return text within a text cell

    You can use wildcard characters with MATCH (and with VLOOKUP, which might be more compact than INDEX/MATCH), so you could do this:

    =IFERROR(INDEX(B1:B10,MATCH("*"&A20&"*",A1:A10,0)),"")

    Hope this helps.

    Pete

  5. #5
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2016
    Posts
    5,913

    Re: Return text within a text cell

    Or:

    =VLOOKUP("*"&A20&"*",$A$1:$B$19,2,0)

+ 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. If cell contains certain text and certain text then return predefined text
    By fuzzhead in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 07-25-2014, 02:18 PM
  2. [SOLVED] How to match a cell with text with a range of text and return own text
    By ec4excel in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 07-16-2014, 11:07 AM
  3. Replies: 5
    Last Post: 01-06-2014, 05:33 AM
  4. 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
  5. Search cell for multiple text , return comma separated text in separate cell if found
    By dangerdoug in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-01-2013, 01:52 PM
  6. [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
  7. If cell contains text1, text2 or text 3 return this text, otherwise return X
    By bukmanodrama in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-26-2013, 09:24 AM

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