Find key word exactly from a text field in Excel - excel

I have a formula below:
=ISNUMBER(SEARCH("Perso",$A2))
I want to it return True for the field that exactly contains my key word "Perso"
However, from the image you can see that both rows return True, because the word "person" also contains "perso".
Can anyone provide some suggestions on how can I achieve my goal in Excel.

Include the deliminating space:
=ISNUMBER(SEARCH(" Perso "," " & $A2 & " "))

Related

Ms Excel IF ISNUMBER SEARCH for multiple text using AND or OR operator

This is my excel data
As you can see in B2, this formula only search for the first text it found and will ignore the rest.
What I'm trying to accomplish is if 2 or more different texts are found like B2, is it possible to print another message ... let say Apple & Banana found
This is my original excel formula for your reference:
=IF(ISNUMBER(SEARCH("apple",A2)),"Apple",
IF(ISNUMBER(SEARCH("banana",A2)),"Banana",
IF(ISNUMBER(SEARCH("cher",A2)),"Cherries",
"Other")))
I have tried and tried and thought hmmm why don't I simply add a SUBSTITUTE function...and it worked ;o)
Just in case there is someone out there looking for this:
=SUBSTITUTE(TRIM(CONCATENATE(IF(ISNUMBER(SEARCH("apple",A2)),"Apple "," "),
IF(ISNUMBER(SEARCH("banana",A2)),"Banana "," "),
IF(ISNUMBER(SEARCH("cher",A2)),"Cherries "," "),
IF(SUM((ISNUMBER(SEARCH({"apple","banana","cher"},A2,1)))+0)=0,"Other "," "))),"Apple Banana","Both")
See if following formula tweak helps you:
=TRIM(CONCATENATE(IF(ISNUMBER(SEARCH("apple",A2)),"Apple "," "),
IF(ISNUMBER(SEARCH("banana",A2)),"Banana "," "),
IF(ISNUMBER(SEARCH("cher",A2)),"Cherries "," "),
IF(SUM((ISNUMBER(SEARCH({"apple","banana","cher"},A2,1)))+0)=0,"Other "," ")))&" found"
Here is my proposal :
You create a Table with your KeyWord and Result in two columns
(columns K for KeyWord and L for Result).
You change your formula like this
=IF(ISNUMBER(SEARCH(K2,A2)),L2, IF(ISNUMBER(SEARCH(K3,A2)),L3, IF(ISNUMBER(SEARCH(K4,A2)),L4, "Other")))
After that, is more easy to add new KeyWord, to change the order if you want to prioritize a KeyWord more than an other.
You can't use more than 63 KeyWords, but you can create a second formula from 64 to 126.

Excel Nested IF AND formula

I can't tell why I'm getting an error with the below formula:
=IF(AND(AL=AM, AK=TRUE), "Unchanged, " ", IF(AND(AL>AM, AK=TRUE), "Downgrade", " ", IF(AND(AL<AM, AK=TRUE), "Upgrade, " ")))
Columns AL and AM contain values 0-4. Column AK contains True/false. If the conditions are met I want to insert the text string. If they are not met, I want to insert the single space to leave the cell blank.
Thank you!
You need to put the nested IFs in the False of the previous:
=IF(AND(AL1=AM1, AK1), "Unchanged", IF(AND(AL1>AM1, AK1), "Downgrade", IF(AND(AL1<AM1, AK), "Upgrade", " ")))
Another method with out the AND():
IF(AK1,IF(L1=AM1,"Unchanged",IF(L1>AM1,"Downgrade",IF(L1<AM1,"Upgrade",""))),"")
You don't need the " " after each of the text strings. The formula wasn't working because you were trying to define 4 parameters in each if statement. removing the ," " should fix this.
=IF(AND(AL=AM, AK=TRUE), "Unchanged, IF(AND(AL>AM, AK=TRUE), "Downgrade", IF(AND(AL<AM, AK=TRUE), "Upgrade, " ")))

SSRS Export to CSV Error

I have an SSRS report that has a column in it that when exported to Excel (XLSX) displays properly, but when exported to CSV, it gives an error that I can't seem to figure out how to fix.
The column value is the following expression (sorry for the formatting, SSRS makes it difficult to format this into an easily readable statement):
=IIF(IsNothing(Fields!SomeField1.Value) Or Fields!SomeField1.Value = "",
"",
(Replace("- " + Fields!SomeField1.Value,
",",
vbCrLf + "-")))
+ IIF(IsNothing(Fields!SomeField2.Value) Or Fields!SomeField2.Value = "",
"",
vbCrLf + "- " + Fields!SomeField2.Value)
The error displayed in the CSV file is:
The value in the CSV's formula bar shows =- N/A. The - seems to be what causes the error but I can't figure out why. This behavior is especially strange because there are other rows with values in the same column like - Test comment and - Yet another testing comment that display without any errors...
The - character is required because the business wants the column to display as a bulleted list. Is there any way to fix this without removing the -?
You can prefix the cell value with an apostrophe (the ' character) to tell Excel that the value you are entering into the cell is to be treated as text rather than a formula and should be displayed as-is.
Sorry don't have rep to comment but you can just add an extra IIF statement around your code block using Globals!RenderFormat = "CSV" to add formatting to the expression for that field. It shouldn't require an extra function (unless this is required for more than just the one field)

Excel search function - match case

I'm trying to find if cells have specific string or not. This is how I do it right now:
=IF(ISNUMBER(SEARCH("AAA";L2)); "yes"; "no")
If a cell has "AAA", I write to another cell yes, if not, I write no...
The problem is that it also gets true answer for AAA1 or AAA1234 for an example, how can I return true statement only for AAA?
If there are trailing numbers/charcters in my string, I want to reutrn no, but the cell itself might be longer... for and example "AAA BVC BFD2" etc. Then I want to return true. False if for an example: "AAA1 BVC BFD2"
As I mentioned in comments, you can use this one:
=IF(ISNUMBER(SEARCH(" AAA ";" " & L2 & " ")); "yes"; "no")
How it works:
suppose you have a string "AAA BVC BFD2" in cell L2.
" " & L2 & " " part modifies this string to " AAA BVC BFD2 " (note, there're additional spaces in the end and in the beggining)
now, we're able to search " AAA " (with spaces) in modified string " " & L2 & " ".
I'm clearly missing something as it seems to me that you could do this with something as simple as
=IF(LEFT(A1,4)="AAA ","yes","no")
I don't think the question is particularly clear, if I'm being honest...

Excel Formula with concatenate

I am trying to generate a customer number using the first three letters of the customers last name, the first name initial and middle initial, followed by the last four of their phone number. How would I do this? All I need is the formula.
First_Name Middle_Initial Last_Name Street_Address City State Zip Phone
Nathaniel E. Conn 6196 View Ct Lancing TN 37770 567-273-3956
Something like this (assuming a table with [structured-references], fill in the actual cell names if not):
=LEFT([LastName] & "---", 3)
& LEFT([FirstName] & "-", 1)
& LEFT([MiddleInitial] & "-", 1)
& RIGHT([PhoneNumber] & "----", 4)
I have used dashes ("-") to fill in any spaces where the field might be smaller than the number of characters you need from it. You can change them to any fill character that suits you.
Well, it depends on if each piece of data has its own column, looks like it does.
You can use the left/right functions to parse the data out of your columns.
=CONCATENATE(RIGHT(C1,3) & LEFT(A1,1) & LEFT(B3,1) & RIGHT(H1,4))
I would do:
=MID(CELL_LAST_NAME;1;3)&MID(CELL_FIRST_NAME;1;1)&MID(CELL_MIDDLE_NAME;1;1)&MID(CELL_PHONE;LEN(CELL_PHONE)-3;4)

Resources