Hi "Mr." Brad Pitt! in column - excel

Column A - first name list
Column B - last name list
Column C - salutation list
I want in column D: HI "salutation" + first name + last name!
I try ="Hi &C1&" "&A1&" "&B1&"!" -> result Hi Mr. Brad Pitt!
But I want the result Hi "Mr." Brad Pitt!

You can use two double quotes where you want each double quote to be, in order to escape it.
="Hi """&C1&""" "&A1&" "&B1&"!"

you can use 2 double quotes to get a double quote in your text.
Try this instead: ="Hi """&C1&""" "&A1&" "&B1&"!"

Try below formula-
="Hi " & CHAR(34) & C1 & CHAR(34) & " " & A1 &" "&B1&"!"

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.

How to add space in a string in excel vba?

how can i add space in this example string?
Input value in cell A1 is ABCDEFGHIJK and will be paste in another cell B1 with a format of ABCDE FG HIJK.
One formula to insert a space:
=LEFT(A1,5)&" "&RIGHT(A1,LEN(A1)-5) to insert a space after the 5th position. (ABCDE FGHIJK)
One to insert 2 spaces as per example:
=LEFT(A1,5)&" "&MID(A1,6,2)&" "&RIGHT(A1,LEN(A1)-7)
Input ABCDEFGHIJK, result ABCDE FG HIJK
In short: Use =LEFT(), =RIGHT() and =MID() to get parts of your string and concatenate the parts and your spaces.
Edit:
In VBA:
Public Function StringWithSpaces(inpStr As String) As String
StringWithSpaces = Left(inpStr, 5) & " " & Mid(inpStr, 6, 2) & " " & Right(inpStr, Len(inpStr) - 7)
End Function

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, " ")))

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...

Move Two characters from beginning to end of string

I have an Excel 2010 document which has hundreds of rows each with a cell as below:
(without the quotes, of course)
"XX - A Name of Something Here"
Which I need to change to:
"A Name of Something Here (XX)"
I'm trying to figure out the best way to accomplish this and could really use some assistance.
Try this:
=RIGHT(A3, LEN(A3) - 5) & " (" & LEFT(A3, 2) & ")"
which means
all but the last 5 chars of the string, counting from right to left
5 because XX space dash space is 5 chars long
a space and an open parenthesis
the leftmost two chars ie XX
a close parenthesis.
This formula will work given your example
=MID(A1&" ("&A1,5,LEN(A1))&")"
How about:
=MID(A1,3,9999) & "(" & LEFT(A1,2) & ")"
but how about the dash??
=RIGHT(A1, LEN(A1) - 5) & " (" &LEFT(A1, 2) & ")"
This will work too - I like "concatenate" since I don't need to keep track of the &'s
=CONCATENATE(RIGHT(A3,LEN(A3)-5)," (", LEFT(A3,2),")")
So many fun ways to do the same thing...

Resources