The tutorial explains the Excel REPLACE and SUBSTITUTE functions with examples of uses. See how to use the REPLACE function with text strings, numbers and dates, and how to nest several REPLACE or SUBSTITUTE functions within one formula. Continue reading
Comments page 7. Total comments: 301
How to swap alternate characters of the contents of a cell in Excel. Example - A cell containing string 123456 should be converted into 214365 and the result placed in another cell.
Tine:
Because the data is not structured consistently it would not be possible to do what you want. In other words, you need to work the data so that there is a "/" in every place you want a break. I put a "/" at the places in the data to achieve what you wanted.
First, I put the cleaned and formatted data in G30 and entered this formula into J30.
Second, I entered this into K30 =LEFT(G30,FIND("/",G30)-1)
Third, I entered this into L30 =LEFT(J30,3)
Fourth, I entered this into M30 =CONCATENATE(K30,"/",L30)
Because of what you want it will take several steps to get you there, but you'll get there.
Hi,
Does anyone have a consistent way to change/replace the following
Bouvier/Antoine --> Bouvier/Ant
Paitard Xavier --> Paitard/Xav
Di Folco/Marc --> Difolco/Mar
De La Reveliere/Patr --> Delareveliere/Pat
Kinzelin/Marie Helen --> Kinzelin/Mar
Ray Jean Pierre --> Ray/Jea
The result should be lastname/3-letters of first name ...
Thanks for your help!
Regards
Tine
Hello sir
My sentence is
Vishal is a good good good boy
And i want change 2nd "good" into "bad" with subsitute formula can u suggest corret way
Hi team,
I am trying to find a way to convert the following dataset to numbers.
eg.
apple banana orange
orange apple banana
banana orange apple
Where,
apple = 1
banana = 2
orange = 3
So, I want to end up with
1 2 3
3 1 2
2 3 1
Any ideas other than using the Replace All button?
Hi Erin,
If you want to display the number equivalents of your text values in the same cells, I'm afraid you will need to use a special macro to achieve this result or keep on using the standard Excel Find and Replace feature.
However, if we suppose that your table with the text values is in A1:C3, and the table with the number equivalents is in A5:B7, then you can try to enter the following formula, for example, in cell E1:
=INDEX($A$5:$B$7,MATCH(A1,$A$5:$A$7,0),2)
After that copy this formula to the adjacent columns and rows. And then you can select the table with the numbers you've got, press Ctrl + C to copy the selection into the clipboard, select your original dataset and use the Paste - Paste Values option to replace the text with the numbers in the original table.
If your dataset is quite large though, using a macro will be the best option for you. You can search for it in VBA sections on mrexcel.com or excelforum.com.
{A:CM06ICIC0SF0001RBIP0NEFTSC1220ALJOEUREWKJLESUKOWEUJKD00NRIDF;DLJFJ20171128 1636}
In this, need to replace Second character A not entire A letter
For instance, I want to change list of numbers that contains first digits of 081 to 234 but some of the digits also have their last numbers as 081. How do I go about it?. Example : Wish to change the first (081) 08130552081 and not the last to 234
Hi How do i do 1234 to 1324 using formula?
=replace(select word,1,4,"1324")
In using the substitute function, when I add an instance number it gives me the #VALUE! error ?? If I omit the instance number it substitutes all instances with no error ??
Thanks
Found the cause of the error: should not check the "Transition formula evaluation" in the Advance Options.
Hope this help.
Hi Team,
Can some one please help me with this substitute formula?
=SUBSTITUTE(SUBSTITUTE(A96,"9(","DECIMAL("),")",",0)")
this is my input[S9(10) Packed Decimal]and it gives output as SDECIMAL(10,0)
now i want to update this same formula to get the below result
[S9(4)V9(2) Packed Decimal]=DECIMAL(5,2) how can i modify this?
i know this is a silly question but i am new to excel :(
Hi,
does substitute leave non matching substrings within a cell unaltered?
Regards,
Ian
I have four columns of data (A1,B1,C1,D1) - each of which contains either "Y", "N" or is left blank. Any number of cells may be blank or none may be blank. I've used Concatenate to put the string together and, based on the result and a series of IF statement, I render a text string result in another column. For example, "YYYY" = "Good", whereas "NNNN" = "Bad". All well and fine but due to the potential blank cells - the string doesn't properly reflect my options. Essentially I'm expected to derive the result based on a four character string from these Y or N inputs. All I really want to do is consistently replace a blank with a "N", so I can get my four character string and do the final rendering. I want to use only Excel formulas and I think Substitute could be used in combination with Concatenate (and the IF statements) to get me where I need to go.
=SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(B2,"A","B"),"B","A"),"C","Z"),"Z","C")
can someone please help me on this.
results: "B" is replaced with "A"
"Z" is replaced with "C"
But "A" isn't replaced it stays the same and neither does "C".
I guess u should use if function rather then subsitute. because this funtion is working as first come first serve basis.
HOW TO REPLACE ALL CELLS
original replace
307(306) 307
304(305) 304
300(303) 303
AT SINGLE TIME HOW TO REPLACE PLEASE SUGGEST
=left(a2,find("(",a2)-1)
I have a giant column that lists various dates and includes a time.
I want to delete the comma and the time- leaving only the date.
example:
10/15/12, 5:21 PM
I want to change to:
10/15/12
or in the same column:
1/4/13, 5:40 PM
I want to change to:
1/4/13
I ultimately want to sort the column by date. But without removing the comma and time I cannot get the column to sort by date correctly. Currently the years do not descend correctly.
Thanks in advance for any help!
Hello,
Please try to do the following:
- Select the column with the data you want to modify;
- Press Ctrl + F and go to the “Replace” tab;
- Enter “,*” in the “Find what:” field, and leave the ”Replace with:” field blank;
- Click on the “Replace All” button.
Hope this will help you.
if in cell a2=1/04/2018 apply this formula
=left(a2,find(",",a2)-1)
if in cell a2=1/04/2018,05:14 apply this formula
=left(a2,find(",",a2)-1)
Hi I'm trying to remove quotation marks with the substitute formula but i am getting stuck. Is there a formula to get the following result.
Text Result Needed
b" Note Note
Since excel is not accepting quotation marks in the formula, im getting really confused. thanks for the help.
Hello,
Please try the following formula:
=SUBSTITUTE(A1,"b"&CHAR(34),"")
Hope it will help you.
I have a formatted number say 1523.15 to 1 523.15
I can't add with it how do I take it out?
The space between the 1 and 5 is not a " ", so substitute(1 523.15," ", "") did not work. BTW the formatting was done in VB6 by format(1523.15,"###,###.##")
Hello Hans,
Please try the following formula:
=VALUE(A1)
Where cell A1 contains the formatted number - 1 523.15.
Hope it will help you.
Hello,
I have data in columns as below
1 xyz abc t.u sfd
2 a.b mnn jjj i.j
3 jjj i.o cdf o.p
I need to replace cell which does not contain '.' with 'NA'. as below..
1 NA NA t.u NA
2 a.b NA NA i.j
3 NA i.o NA o.p
Finally I need to arrive at something like below.
1 t.u
2 a.b i.j
3 i.o o.p
Help me on this pls.
hi,
i need this MWCU 677.352-8 need to come MWCU6773528
if possible I would like to strip everything and get the Order ID. the problem is : Location of the order id and sometime it begins with A or 1. Cell Example A1: {"Ref":"bad order","OrderId":"ABSER27"} Cell Example A2: {"OrderId":"ABSER27"} Cell Example A3: {"order_id":"12345678","customer_email":"BADORDER@gmail.com"}
Desired result: B1 = ABSER27 Desired result: B3 = ABSER27 Desired result: B3 = 12345678
I have a column of scanned numbers in column "A". some of these numbers are repeated several times down column "A". I need these numbers in column "A" to be changed to a predetermined part number in column "B" every time they appear eg:
A B
Code Part Number
45627 7yh7895
214789 4hj21345
496581 65753p
45627 7yh7895
45627 7yh7895
214789 4hj21345
45627 7yh7895
Can this be done using substituent& replace function in excel.
Thanks for your assistance
My previous question didn't read as I would've liked
The first 3 things are in column F: then the substitution (where 23 subs in for 14) is in column E. With the subsequent chance with 23 subbing in for 14 (I have that backward in my pervious question. With the new list (with 23 in and 14 out) now in the F column.
So column E would read:
E2: whatever
E3: whatever
E4: whatever
E5: sub in 23
E6 sub out 14
column F would read:
F2: (1, 2, 14, 32, 55) (this is the starting list which is provided)
F3: either the list again or blank, it doesn't matter which
F4: same as F3
F5: (1, 2, 23, 32, 55) this could happen in F5 or F6 it wouldn't matter, but I would want excel to recognize the 23 in and 14 out and make the change in column F.
Is that possible? If so what is the most efficient way to do it?
Thanks for your help.
Kevin
Hello, I am trying to find a way to have a column where excel finds a substitution and replaces one person with another. So, it would look like this.
Column E: Column F:
IN (1, 2, 14, 32, 55) (the in isn't important, just the numbers)
IN (1, 2, 14, 32, 55) (or blank, whichever,)
" " "
sub in 14 IN (1, 2, 23, 32, 55)
sub out 23
And so on and so forth. Is this possible?
Thanks.
thanks Svetlana
can you please change the following format into date :
17.12.26(W52)
Hi :)
I am loving this web site. I have learnt more in the past few weeks than what I've learnt in years!
I am however trying to find out a way to do the following.
I have a column with a series of numbers - 1 means Paid, 2 means Unpaid 3 means Cancelled etc - Now what I want to do is replace the numbers with its text value. I've been tryng a couple of formulas but they not working quite like I want it too - example if its 1 then change it to paid, if its 2 then change to unpaid and so forth.
How can I do this?
Hello! This is similar to what I need. I need to replace (or substitute) a character (and just the first of this character) in ALL of our products.
We have product Spuhr-SP-3016 and AI-0497. I need to replace just the first "-" in the Spuhr item with a ":" and the "-" in the AI item which is the only "-" with a ":".
This will also need to be done for every product in the A column, not just a single cell. Every example I find is for one cell. Is this possible with a Replace or Substitute formula for all of column A?
Hello,
If I understand you correctly, the names of the products are placed in different cells of column A. Let's assume that 'Spuhr-SP-3016' is in A1 and 'AI-0497' is in A2, and you want the new values to appear in column B. Enter the next formula into B1:
=SUBSTITUTE(A1,"-",":",1)
and copy it down the column B.
But if you want to replace the characters right in the cells where the names are situated, you need to use Find-Replace. But in this case, you must be careful not to change the second '-'.
But display should be as in E12 & E18. In counting total, the amount in E12 & E18 should be substituted with F12 & F18. I think it is clear now. Pls help me.
Hi,
I have problem with adding, for example the column E from 10 to 25 currency numbers. total added in E 26. Also currency numbers in F12 and F18, I want to substitute E12 and E18 to F12 & F18, but only while counting to the total. Please help me.
I want to make a value as "0" for the number falls between -10 to +10. Which formula can i use.
Please suggest
Hello, Siddhesh,
assuming that the number is in A1, the formula may look like this:
=IF(AND(A1>-10,A1<10),0,A1)
For more info, here are a couple of links for you - Using IF function in Excel, IF with multiple conditions.
Im trying to work out how to replace a formula with another formula.
Cant just drop it down as it will mess up my subtotals.
Any suggestions?
Hi Sal,
there's slightly different Excel option you can use: Find and Replace. The very firs part of the article covers what you need, look for 'Excel Find - additional options' subtopic, and you will see how to find and replace various data in your formulas. Hope it helps!
I want add dash in a coloumn which consists of clients name ..
clients name is as follows
jidf
Baysee
carparl
it should looks like
JI_DF
BAYS_EE
CARPA_RL
after last two words i need to add an dash.
Plese help me to sort it out,
Regards
Sunil
I have exported a SharePoint list to Excel and in a cell where I have multiple names I get a ; # and a number. I would like to eliminate them and only have the names with a semicolon separating.
for example:
Smith,Sue;#9800;Jones,Edward;#9783;Garcia,Pablo;#12958
Smith,Sue;Jones,Edward;Garcia,Pablo
Hi i would like to substitute 0 for 5, 1 for 6, 2 for 7 and vice versa.
Which means that if the original value appears as a 0, it would show as a 5.
If the original value appears as a 5, it would show as a 0.
=SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(B2, "0", "5"), "5", "0"), "1", "6"), "6", "1"), "5", "0")
This is part of my formula, but when the results are out,
0 stays as a 0 but 5 becomes a 0.
1 stays as a 1 but 6 becomes a 1.
How do i make the substitution go both ways?
Oops sorry that was the formula i was doing when experimenting.
=SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(B2, "0", "5"), "1", "6"), "2", "7")
This was the original formula
thanks
Data in Cell A1=MH 99-CA-9875,how to replace all "space" & "-".
And result should be MH99CA9875.
For the Twelve Months Ending Thursday, June 30, 2016
I have the above text in excel and I need an excel formula to extract ONLY the date June 30, 2016. The formulas I've researched were all for numerical dates (i.e. 06/30/2016). Would anyone know how to do this? Thanks in advance!
Hi there.
An amazing article, so helpful.
I'm trying to read a number and substitute this for a text string using "the number" to repeat some character.
Something like that:
read "5" and substitute it for "*****"
read "3" and substitute it for "***"
In this example I've used "*" but I can use any another one.
Thank you.
What if I wanted to be able remove everything after the 7th character. For example I have something like "UX12345: This is a user story" but the UXXXXXX can be any number. So I want to remove everything after UXxxxxx including the :
hi,,stated example =SUBSTITUTE(F5,"f5","BFP-06") i wanted that if f5 cell will be inputed the result will be BFP-06..could that be possible,,i really needed it to ease my report..
The only problem now is that my entry for f5 is different in the succedding cell below
Super helpful. Thanks!
in a cell with formula getting result as PGS or GS or S, at the same time I want to replace if cell result PGS with replace with " platinum " similarly GS with "Gold" and S with "Silver"
Hello,I have business task and I really don´t know how to deal with it. I have table of data e.g.
A B C D Result
2021 5044 NEMR 5038 ?????
and I need to put into cell result: find value of cell D (5038) in column B and replace it with data from column A on the same line. Data in column B are unique and in column A too.
I tried replace, find but probably there will need to be some multi task.
Thank you
Martin
a b c d Result
1 2 aa 2 1
2 4 aa 3 #N/A
3 6 aa 4 2
4 8 aa 5 #N/A
5 10 aa 6 3
=OFFSET($A$1;MATCH(D2;B:B;0)-1;0)
If you don't wish to have N/A than simple error handling can be added:
=IFERROR(OFFSET($A$1;MATCH(D3;B:B;0)-1;0);"Not found!")
Need a formula to transform the data in A1 to B1
Cell A1 Cell B1
John Doe John.Doe@ABC.com
The user types the data in A1 and B1 is auto populated.
The only thing I've been able to come up with is to use the SUBSTITUTE formula to convert the "John Doe" to "John.Doe".
Thanks in advance for your help!
Hi Randall,
Simply concatenate your SUBSTITUTE formula with a text string, like this:
=SUBSTITUTE(A1, " ", ".")&"@abc.com"
Hi Svetlana,
Awesome! That did the trick. Thank you!
I have a different problem. I work with a DB and the owners don't want to change something that would make my life easy. When I download the member file to Excel, it has all the member profile information I need to create the hard copy directory. After I download the file, I have to erase columns and lines and then sort to create the directory file (printer works with an excel file). This is unnecessary work. Especially since there is a view that has all the exact profile information needed. When I copy that view and paste it into excel the four entryies (name, phone, address and Email each have their own cell... perfect! However there's one major problem. Here's the cell that includes the e mail address for all 400 members:
Send an Email to snrisa8 @ aol.com
Send an Email to suealbert1 @ yahoo.com
Send an Email to ralfin @ hargray.com
Send an Email to shanialp @ aol.com
Is there a way to remove the Send an Email to in each cell and only leave the email address? Application owner will not remove the header that only appears when you cut and paste that view.
Thanks,
Jon
Use Find and Replace
Select the column, then in Find and Replace, enter the words "Send email to" and replace with nothing (leave the Replace line blank.
Then click Replace All"
=SUMIFS(D3:D1500,C3:C1500,"=ETL",i3:i1500,"=23/11/2016")
Above is a command used in an xls sheet by me (in A2). Such lines are used in many other lines also.
I want to replace 23/11/2016 with A1 (a date field) which I will be changing very often. Kindly advise how to do this.
With thanks and regards,
how to change 32642/319/09-07-08 only change 32642-319/09-07-08 this format all sheet only change firt / to - not change all
i need little guidance regarding using excel commands please help
i have some numeric values in excel sheet and i want to convert the multiple digit values into single digit by recognizing the 4th number of multiple digit value.
for example the value is 946198763 i want to covert this serial into 2 when there is always 1 at 4th place after 946 .
this whole value should be replaced by 2 only.
how can i do this?
Hi!
I need to replace from various post codes the “*” for some which are highlighted. My problem is that not all post codes have the same length, and when I try to replace, I loose part of the code too.
For example I have my Column populated with: “MK5 8NG, MK6 2ED*, YO24 1KA, YO1 6DP* etc…”
As you see not all post codes are the same length and not all post codes are marked with an asterisk (*).
Thanks for the help,
Phil
I want to change certain letters into a number value but when I input the substitute function it said I had too many arguments. =SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A7,"w","5"),"gs","4"),"c","3","x","2","ru","1")
What I really need is a formula that changes letter value to a number then I want to add the numbers i.e. wgs=12, or wcx=10
Can I do this in one formula or do I need to do two separate columns?
Thank you in advance
Trish