+ Reply to Thread
Results 1 to 22 of 22

Text Search and Return Results ?

  1. #1
    Registered User
    Join Date
    10-23-2018
    Location
    New York
    MS-Off Ver
    10
    Posts
    27

    Text Search and Return Results ?

    I might be not thinking the obvious here but quick question. I have a customer who wants to do text searches off a column and return all rows with a keyword that is found. Any suggestions to the most efficient way to do this? Basically I have columns from A-G. The searched column would be G. If the keyword pops up it populates all columns of that row. We are doing an SSRS report for this but also want to see if it can be created in Excel...Any help would be appreciated.

  2. #2
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,887

    Re: Text Search and Return Results ?

    Without workbook sample hard to give you specific help. But it can be done.

    There are several different ways to do this.

    1. Using Advanced Filter Copy with small VBA.

    2. Using PowerQuery and M function Table.SelectRows() (i.e. filter with string contains). Passing variable from sheet to M query.

    3. Using formula. Such as INDEX(Range,SMALL(IF(ISNUMBER(Search(Word,Range)),ROW(Range)-Offset),Rows($A$1:A1))) array formula.
    ?Progress isn't made by early risers. It's made by lazy men trying to find easier ways to do something.?
    ― Robert A. Heinlein

  3. #3
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,064

    Re: Text Search and Return Results ?

    You want a formula solution?
    Assume the following

    Sheet1!A1:G1000 contains your input data with column G containing a keyword anywhere in each G cell.
    Sheet2!H1 contains the search word
    Output goes to Sheet2

    in Sheet2!A1
    =IFERROR(INDEX(Sheet1!$A$1:$G$1000,AGGREGATE(15,6,ROW($A$1:$G$1000)/((ISNUMBER(SEARCH(H1,Sheet1!G$1:G$1000)))),ROWS(A$1:A1))-(1-1),COLUMN()),"")
    copy down for as many rows as you have data on Sheet1
    Regards
    Special-K

    Ensure you describe your problem clearly, I have little time available to solve these problems and do not appreciate numerous changes to them.

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

    Re: Text Search and Return Results ?

    Hi common,

    This sounds like using an Advanced Search to me. In the criteria field, if you are looking for "Stuff" you would use a criteria of "*Stuff*" so it would pick up what you want.

    Another method might be to create a Conditional format looking for a word that matches a single criteria, using the wildcard "*" again.

    https://support.office.com/en-us/art...bdff32b#bkmk_6
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  5. #5
    Registered User
    Join Date
    10-23-2018
    Location
    New York
    MS-Off Ver
    10
    Posts
    27

    Re: Text Search and Return Results ?

    thanks all. I think youve all given me enough info to play around with this. appreciate all of your prompt replies!!! have a great day!

  6. #6
    Registered User
    Join Date
    10-23-2018
    Location
    New York
    MS-Off Ver
    10
    Posts
    27

    Re: Text Search and Return Results ?

    I am not doing something right. If you have a sec can you see if I am doing something incorrectly assuming my ranges are accurate? Thanks.

    {=IFERROR(INDEX('OBS RAW'!$A$1:$T$6109,AGGREGATE(15,6,ROW($A$1:$T$6109)/((ISNUMBER(SEARCH(U1,'OBS RAW'!$R$1:$R$6109)))),ROWS(A$1:A1))-(1-1),COLUMN()),"")}

  7. #7
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,064

    Re: Text Search and Return Results ?

    We are using AGGREGATE so you dont need array formula.

    The rest looks ok, just checking...

  8. #8
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,064

    Re: Text Search and Return Results ?

    It's working for me (see attached)

    Can you post your file? Beware of sensitive data.

    Use the Go Advanced option at the bottom of the page then scroll down to Manage Attachments as the "paperclip" method does not work on this forum.
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    10-23-2018
    Location
    New York
    MS-Off Ver
    10
    Posts
    27

    Re: Text Search and Return Results ?

    I cant post because of that but looking at your file now and it explains everything. thanks again.

  10. #10
    Registered User
    Join Date
    10-23-2018
    Location
    New York
    MS-Off Ver
    10
    Posts
    27

    Re: Text Search and Return Results ?

    Two questions from the workbook and how I detailed my issue (my bad). Your formula as follows:

    =IFERROR(INDEX('OBS RAW'!$A$1:$T$6109,AGGREGATE(15,6,ROW($A$1:$T$6109)/((ISNUMBER(SEARCH(AA1,'OBS RAW'!$R$1:$R$6109)))),ROWS(G$1:G1))-(1-1),COLUMN()),"")

    Under Search shouldnt the AA1 be locked down for when we drag the formula? This is where it is doing the word search correct?

    Other is my explanation. The field it is searching is a comment cell. Basically we want to type a keyword into AA1 so for instance car, and if that word shows up in the text detail it will populate so it isnt a scenario where there is a category or one term in the column we are looking for rather a paragraph where we want that result to show if any word comes up in it. any help would be appreciated when you have time. thanks.

  11. #11
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,064

    Re: Text Search and Return Results ?

    Under Search shouldnt the AA1 be locked down for when we drag the formula? This is where it is doing the word search correct?

    Yep you're right it should $AA$1 probably

    SEARCH will find the position of $AA$1 in 'OBS RAW'!$R$1:$R$6109 cells or return an error.
    So if ISNUMBER() is true then $AA$1 was found.
    IFERROR(...,"") produces a null for any cells where the search word was not found.

    I don't know if this will work on comments attached to a cell, I don't have any expertise on comments.
    This is my version of a fairly standard formula which is used for making lists smaller, like removing blanks from cells, but it can also be applied to searching for other things in cells.

  12. #12
    Registered User
    Join Date
    10-23-2018
    Location
    New York
    MS-Off Ver
    10
    Posts
    27

    Re: Text Search and Return Results ?

    ok thanks. i will play around with it.

  13. #13
    Registered User
    Join Date
    10-23-2018
    Location
    New York
    MS-Off Ver
    10
    Posts
    27

    Re: Text Search and Return Results ?

    I might have to repost this question because I didnt explain properly. Your approach works perfectly for single words and even partial sections of words but the text format I have isnt working with it.

  14. #14
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,064

    Re: Text Search and Return Results ?

    Can you post a small amount of the data as a spreadsheet?

  15. #15
    Registered User
    Join Date
    10-23-2018
    Location
    New York
    MS-Off Ver
    10
    Posts
    27

    Re: Text Search and Return Results ?

    I really cant. But will give you an example. The cell itself is tagged General and it has paragraphs in it. So something like this. Say we want all cells with the word car in it to display from the below:

    The car went down the street and went through a stop sign. It was promptly pulled over by police.

    That specific cell would then be populated into the tab with the formulas.

  16. #16
    Forum Expert azumi's Avatar
    Join Date
    12-10-2012
    Location
    YK, Indonesia
    MS-Off Ver
    Excel 2019
    Posts
    2,368

    Re: Text Search and Return Results ?

    If your data is confidential, use false data but still describe the situation and condition of your original data and the results you want

  17. #17
    Registered User
    Join Date
    10-23-2018
    Location
    New York
    MS-Off Ver
    10
    Posts
    27

    Re: Text Search and Return Results ?

    I created a separate spreadsheet to show what I am looking for. I want to search for keywords in column G text field. If any occurrence of a word shows up, then I want the entire row to display. Then displays every occurrence of that word in the entire dataset same way.

    So if the word car is typed into the cell, rows 2 through 4 show up in the tab. I am attaching the sample. Any help thanks.
    Attached Files Attached Files

  18. #18
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,064

    Re: Text Search and Return Results ?

    I;m still a little confused.

    "I want to search for keywords in column G text field"

    G2 contains "The car went down the street"
    What are we searching for? are we searching for each individual word "the", "car", "went", "down", "the", "street" on row 2?

    Or are we searching for just one search word (which your spreadsheet doesnt contain)?

  19. #19
    Registered User
    Join Date
    03-21-2019
    Location
    NY
    MS-Off Ver
    12
    Posts
    7

    Re: Text Search and Return Results ?

    How is it?

  20. #20
    Registered User
    Join Date
    10-23-2018
    Location
    New York
    MS-Off Ver
    10
    Posts
    27

    Re: Text Search and Return Results ?

    I was offline yesterday. I want to be able to type one or two words in and if those words are found in the cell than return the entire row. The customer is interested in typing a keyword in and then getting all the entries that contain those words. So in the car example, simply typing car to return every entry in G that has that word in itn.

  21. #21
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,064

    Re: Text Search and Return Results ?

    See attached column M
    Attached Files Attached Files

  22. #22
    Registered User
    Join Date
    10-23-2018
    Location
    New York
    MS-Off Ver
    10
    Posts
    27

    Re: Text Search and Return Results ?

    thanks so much. this is perfect. appreciate your help. very nice of you to take time.

+ 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. Return Results from two search columns
    By RHudson714 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-04-2018, 11:40 PM
  2. How to return multiple results in a search
    By jrlafrance in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 05-22-2017, 09:25 PM
  3. [SOLVED] Code to search Excel and return results even if part of search text is present
    By Taoyuan00 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-30-2016, 09:20 AM
  4. Replies: 2
    Last Post: 05-14-2015, 01:30 PM
  5. [SOLVED] search for specific text in a file and return a value to a cell based on the results
    By JJGF in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 01-03-2013, 07:00 PM
  6. How to search and return results
    By the deeb in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 02-09-2011, 05:57 PM
  7. Return search results??
    By itsacatfish in forum Excel General
    Replies: 3
    Last Post: 09-02-2010, 01:33 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