I have a spreadsheet with text in column A.
For example
A1=MY TEXT1
A2=MY TEXT2
A3=MY TEXT3
A4=MY TEXT4
A5=MY TEXT5
I want to add an apostrophe to the front and back of the text
Result to be:
B1='MY TEXT1'
B2='MY TEXT2'
B3='MY TEXT3'
B4='MY TEXT4'
B5='MY TEXT5'
It seems like a straight forward thing to do. Any one know how?
Use this formula:
="'" & A1 & "'"
=CONCATENATE("'";A1;"'")
Related
I am trying to replace a part of string in "input1" with values in column "input2" to get the "output" as shown:
Any idea how to do this in MS excel?
Try below formula-
=SUBSTITUTE(A2,"replace_this",B2)
In addition to the REPLACE and SUBSTITUTE function, if you just need to add something before and/or after some other value (as shown in your picture), you could just use simple concatenation:
="Text-before-value" & B2 & "Text-after-value"
A
B
C
1
Input1
input2
output
2
abc_'replace_this' xyz
replace1
=REPLACE(A2,FIND("replace_this",A2,1),LEN("replace_this"),B2)
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.
Is there a way in excel if I have a bunch of phone numbers in 1234567890 format, that I could find ranges and paste in the format of XXXXXXXXXX-XXXX?
I tried with some mid formulas but it's not working quite right.
=IF(A63=A62+1,A62 & "-" & A63,"NO ")
EDIT:
1234567890
1234567891
1234567892
1234567893
1234567897
1234567898
1234567899
5552221212
5552221213
Should look like:
1234567890-7893
1234567897-7899
5552221212-1213
EDIT 2:
If you throw in an odd ball between the mix say, 5555555555, I don't want to make 5555555555 link with any of those numbers.
For example, currently, I am looking at this further down on my spreadsheet: =IF(A209=A208+1,A208 & "-" & A209,A209). Basically, it posts the TN above it with the number after. What happens is going down the list above I'd get
1234567890 - 1234567891
1234567891 - 1234567892
Is there a way to make it show only 1234567890 - 1234567892?
If all the numbers are of the same format and you always want the "-" inserted before the last four numbers this will do the trick
In an excel formula:
=LEFT(A1;6) & "-" & RIGHT(A1;4)
In VBA
Dim text1 As String, text2 As String
For i = 1 To NumberOfRows
text1 = Cells(A,i)
text2 = Left(text1,6) + "-" + Right(text1,4)
Next i
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)
I'm debugging some ColdFusion code (although the question is really language-agnostic), and from the debug output, have two columns of text.
Those columns are field name <tab> value and want to be able to quickly convert this into test code.
The text I start off with:
a 1
b 2
c 3
etc
The code I want to end up with:
structInsert(myStruct, "a", 1);
structInsert(myStruct, "b", 2);
structInsert(myStruct, "c", 3);
etc
Ordinarily, I'd use Excel, pasting the two columns of data into columns A and B, and create a formula in column C that concatenates A and B something like
="structInsert(myStruct, """ & A1 & """, " & B1 & ");"
This works fine (and is one of the main reasons I love Excel).
But I'm wondering... given that the whole world doesn't have Excel, how does everyone else do this?
Thanks!
Well I like to do with Notepad++ or Eclipse with search and replace feature with regular expression.
Like search for
([a-z]*)\t(\d)
replace with
structInsert(myStruct,"\1",\2);
So simple.. right?
You could do this with regular expressions.
In CFEclipse/CFBuilder open the Find/Replace dialogue
Find: ^(.+?)\t(.+?)$
Replace with: structInsert(myStruct, "$1", $2);
Check Regular Expressions
Click Replace All