Keyword Searches - excel

I have a project where I am given a large amount of information and a description of what issues I am handling. I would like to create a cell at the end of the row that would return yes or no after it performs a search across a row for a specific keyword or piece of text. I have tried using the if(Search()) function, but it only allows for one cell in the row to be searched for the keyword. This would work, but the Keyword(s) that I'm searching for may appear in different columns of the row. Is there anyway that I can create a formula to search the entire row for specific texts? And if any instance of a list of keywords that I have put into the formula appear, can it result in a customizable text response (Yes or no)?
Thanks.

Say in the first row we want to know if we can find "happiness" anywhere in A1 thru C1. In D1 enter:
=IF(ISERROR(SEARCH("Happiness",A1 & B1 & C1)),"No","Yes")
If you have more cells, just increase the concatenation.

you can use COUNTIF to locate a piece of text -any result greater than 0 means the text has been found
use =COUNTIF(A1:F4,"Your Text") if you have to have a full cell match
use =COUNTIF(A1:F4,"*Your Text*") if you want a partial match (e.g. "Dog" will match "CatDog" and "Dogma")
Wrap this in an IF statement to get your desired response
=IF(COUNTIF(A1:F4,"*" & G1 & "*")>0,"Yes","No")

Related

How to Search for Multiple Terms in Excel and Return a Phrase?

I'm trying to check if a term is present in one cell, and then return a value if that term is present.
For example, in the cell A1, the phrase "marriott marquis houston" is present, I want, if the word "marquis" is present, for there to be an output in cell B1 saying "marquis". I want to check for several terms so this should be respeatable
=IF(SEARCH("jw",E258)," jw marriott",
IF(SEARCH("westin",E258)," Westin"))
etc, but it didn't work
I tried using =XLOOKUP(TRUE,ISNUMBER(SEARCH(Sheet3!A:A,E30)),Sheet3!B:B,"")
with the table below, but I'm getting #NAME?
Reference Table
Put your lookup and wanted outputs in a table and use XLOOKUP:
=XLOOKUP(TRUE,ISNUMBER(SEARCH(G1:G2,A1)),H1:H2,"")
If one does not have XLOOKUP then INDEX/AGGREGATE will work:
=INDEX(H:H,AGGREGATE(15,7,ROW(G1:G2)/(ISNUMBER(SEARCH(G1:G2,A1))),1))
One note on these. this will return Westin if Westing is found in the text string, it does not look at whole words.
If that is desired, change the SEARCH to include spaces:
SEARCH(" "&G1:G2&" "," "&A1&" ")
Though note that if there is punctuation, that may need to dealt with also.

How to return multiple cell locations using Match and Address function

I have a column with thousands of records and I am trying to match a set of other inputs to it, while returning the location of the match from the range A:A.
The following formula does it fine (it returns a location of the presumably first record/match which is longer than two characters from column A), however I would like to get ALL locations of the match from the column A (in one cell if possible, but not necessary) where the searched word appears.
=IFERROR(IF((LEN(H9)>2);(ADDRESS(MATCH("*"&H9&"*";$A$2:$A$100000;0);1));"");"")
I have tried the Textjoin function, but it still returns only one location despite multiple occurrence of the searched word (maybe I'm doing it wrong?).
=TEXTJOIN(";";TRUE;IF((LEN(I2)>2);(ADDRESS(MATCH("*"&I2&"*";A2:A100000;0);1));A2:A100000))
To illustrate better what I'm trying to achieve: Let's say there is word "ball" in the cell H9 and I can see that cell A33; A10 and A222 have the word ball in its content (e.g. handball;football;basketball) - therefore the desired output would be A33;A10;A222 in the destination cell(s).
Hope that makes sense!
Thanks a lot for your help!

Count number of times specific text is in an array

I have a list of annoyingly non-standard data, the titles of trouble tickets, that I need to find a way to standardize into categories and then count the number of cells that fall into one of the categories. I have been attempting to use the following formula:
=SUMPRODUCT(--ISNUMBER(SEARCH(G:G,A2)))>0
Where G is my list of categories and A2 is the first cell in my list of ticket titles. The issue is this formula just returns TRUE or FALSE, which is not helpful in my case. Does anyone have any suggestions? Here is an example of the data I am dealing with:
web browser pointing to wrong web page
excel will not save
outlook popups on startup
logon issue
etc
It would be useful if instead of returning TRUE, the formula returned whichever category it found, i.e. if it found browser in the category array, for the first example it would return browser, rather than TRUE.
Try this formula
=INDEX(G$2:G$100,MATCH(1,INDEX(ISNUMBER(SEARCH(G$2:G$100,A2))+0,0),0))&""
If multiple items in G2:G100 appear in A2 then this will just list the first one (from G2:G100)
Note: if you have "Brow" and "Browser" in the list then it will find both and return the first in the list, so you need to list them with the longest first, ideally, or change to this version so you only match whole words
=INDEX(G$2:G$100,MATCH(1,INDEX(ISNUMBER(SEARCH(" "&G$2:G$100&" "," "&A2&" "))+0,0),0))
The first formula returns a blank if nothing found, the second one returns #N/A
Edit:
If each category in G2:G100 has an associated text in adjacent column H2:H100 then you can change the formula to return the column H value by changing the very first range in the formula, e.g.
=INDEX(H$2:H$100,MATCH(1,INDEX(ISNUMBER(SEARCH(G$2:G$100,A2))+0,0),0))&""
I think you should reverse your logic in that case, and put a formula next to each category (in H:H) with a COUNTIF, so in H1:
=COUNTIF(A:A, "*"&G1&"*")
And so on down the column.

Search cell for text and add if not found

I have a product spreadsheet that contains a row with file names of images. Some have the file extension and some don't. I am trying to figure out a way to avoid adding ".jpg" to an entire column of cells in my excel worksheet. Is there a method that can help me search to see if the specified filename in the cell is already ending with .jpg? At the same time is it possible to add .jpg if its not there? I have tried with Concatenate and IF statement, but I am not having any luck.
Is there a function or method that can search if my cell contains the file extension(.jpg to be specific) and if nothing specified, is it possible to add one such as ".jpg"?
I created the following spreadsheet, as you can see some of the values have the extension ".jpg" and some don't
A
1 one.jpg
2 two
3 three.jpg
4 four.jpg
5 five
6 six
7 seven.jpg
8 eight
9 nine.jpg
I am assuming that you meant you had a spreadsheet similar to the sample I typed here, with more entries
I google for a way to read the last 4 characters of a cell in excel, this gave me the =RIGHT(A1, 4), this means that wherever you type this formula you will get the last four characters of A1
So using IF + RIGHT + CONCATENATE I was able to read the values in the A column
If the last 4 characters in the A1 are the same as the string ".jpg" then just give me back the value of A1, if the last 4 character of A1 are NOT the same as the string ".jpg" then give me back the concatenation of A1 and the string ".jpg"
the formula is as follows
=IF(RIGHT(A1,4)=".jpg",A1,CONCATENATE(A1,".jpg"))
instead of using the string ".jpg" you can type the string in a cell and use the cell number.
I have this formula in column E, I first wrote in E1, I then copied it to the rest of the cells in column E, this means that a copy of column A is being created, I do not know if the formula can be changed so that the formula searches the cell/column where it is written.
I hope this is of some help, and if you see any errors, or know of a better way to do this feel free to correct/share, as I myself am learning
Good luck
I'm assuming you want to solve this using worksheet functions rather than VBA code, I would use some variation of the following:
=IF(RIGHT(A1, 4)=".jpg", A1, A1&".jpg")
This formula looks at cell A1 and adds .jpg to it if it doesn't already end in .jpg
I can't guess how to integrate it into your sheet but should give you a good start

How to use Excels COUNTIF in every nth cell and retain wildcard functionality

I have been looking every where on the net and everyone seems to simply suggest an alternative like SUMPRODUCT, however, I want to use wildcards. Wildcards work fine in COUNTIF but not in other alternatives I have seen.
How can I search every nth cell in a column and return a count of the number of times an exact substring is found (i.e. COUNTIF(range, string), where range is every nth cell and string could be "*somestring", "some string*", "*somestring*" or "some?string")
Yes, SUMPRODUCT is an option - say you want every 5th cell starting at A2 (i.e. A2, A7, A12 etc.) you can use this formula to count instances of "text" in those cells (possibly within other text)
=SUMPRODUCT((MOD(ROW(A2:A1000)-ROW(A2),5)=0)+0,ISNUMBER(SEARCH("text",A2:A1000))+0)
change the 5 to whatever n you want - it always starts with the first cell in the range if you use this syntax.
The ISNUMBER(SEARCH part gives you the equivalent of a "wildcard" search (you can't use actual wildcards here)
update
If you want the equivalent of "text*" then use LEFT function, e.g.
=SUMPRODUCT((MOD(ROW(A2:A1000)-ROW(A2),5)=0)+0,(LEFT(A2:A1000,LEN("text"))="text")+0)
and RIGHT can be used for the equivalent of "*text".
IF you want the equivalent of "t?xt" that would be trickier. The SEARCH function in the first formula will allow you to search for "t?xt" but that would be amongst other text so if you want the entire contents to be "t?xt" you could add another check, e.g.
=SUMPRODUCT((MOD(ROW(A2:A1000)-ROW(A2),5)=0)+0,ISNUMBER(SEARCH("t?xt",A2:A1000))+0,(LEN(A2:A1000)=4)+0)
That will only count cells which contain "text", "toxt", "t5xt" etc. but not "text2"

Resources