Replace Characters In A String
Feb 11, 2009Replace characters in a string. I have this macro:
View 2 RepliesReplace characters in a string. I have this macro:
View 2 RepliesI recently became owner of a spreadsheet with some issues, and I am trying to make it useful. Each row has a URL of a blog post, and I want to extract the date from it (which is present in each URL) while getting rid of the rest of the URL. I was able to get rid of everything up to the year (which comes first), but then the URL continues, for example, 2013/05/16/the-rest-of-the-url/ and I would like to just have 2013/05/16 remain.
I am trying to use find and replace with the find box reading 2013/??/??/*/ and replacing it with 2013/??/?? which effectively erases everything else in the url, but leaves ?? instead of the numbers. Is there any way to have it so that it keeps whatever was in the original box?
I have the following type of info in A1,A2,A3...
Code:
nameGaryage40cityPittsburgheight190
age30height150
ameLindacityMichigan
citySan Jose
ameHarryheight180age50
My goal is to get as close as possible to this,so it will be easier to sort and manage
Code:
nameGaryage40cityPittsburgheight190
nameLindaage30cityMichiganheight150
nameHarryage50citySan Joseheight180
I can't use the "" sign as delimiter to separate them into different columns because the age,city,name and height fields are in random positions on different cells.The good thing is person's name will always come after "name" string, age is alwals followed by "age" string, so it cannot be like nameheight40Michigan180
I think the following would be the easiest method(not for me tho).If on B1 I had a formula that said "find the string "name" and write anything after it until you reach the next "" character".On C1 field I could have a formula "find the string "age" and write anything after it until you reach the next "" character.On D1 I would have the same for "height" string,then on E1 for city string.
My question is somewhat similar to this one
Extract A String Between Two Characters
Formula which outputs the data between 3rd and 4th instances of the "_" character.Can we substitute "3rd and 4th" with a specific strings like "age" or "height" ?
Code:
=TRIM(LEFT(SUBSTITUTE(MID(A1,FIND("|",SUBSTITUTE(A1,"_","|",3))+1,LEN(A1)),"_",REPT(" ",LEN(A1))),LEN(A1)))
I have some records that include greek addresses. The greek alphabet contains letters that are common to the english one (A,B,E,Z,H,I,K,M,N,O,P,T,Y,X) and records with mixed characters will cause me problem. What can I do to find and replace any of those letters with the greek version of the letter.
example:
for a record:
T..5123 (this is the Greek abbreviation for P.O.BOX 5123)
I'm looking for a function to replace the first letter T (wether is Greek or English) with the Greek version of it
example 2:
KYMH 6 (kimis is the street, 6 the number)
I should replace English (first four ) letters with the Greek version...
example 3:
BAPITOY 14 (valaoritou is the street, 14 the number) ...........
A range of cells contain characters that i want to replace with spaces. The problem is that the length of the string differs and also the characters differ.
For example, below a list of cell values:
GR
GRKR
GRKRKR
GRKRK1
GRON
GRONBL
As a result for the first value i want 2 spaces, for the second one 4 spaces etc.
Is it possible to do this with a formula? I don't want to use VBA for this if possible...
I'm trying to do a quick find and replace across a range of cells to remove Chr(10) and Chr(13) characters. For some strange reason, some of the cells are being good and duly allow the removal of said characters and some are not - they stubbornly refuse to remove with no error message. The ones that are not allow removal if I copy the individual cell to a new sheet.
Sub removeCharNew()
'Dim x As Integer
Cells(1, 1).Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Cells.Replace Chr(10), ""
Cells.Replace Chr(13), ""
End Sub
Is it possible to display a dialog box or msgbox that doesnt have an OK button ?
i.e I want a message that comes up on the screen that says "Links Updating...Please Wait" which then automatically changes to "Links Sucessfully Updated" on completion...I dont want the macro to be interrupted by the msgbox/dialog...
I download several sets of data from an internet site. The only way I can do this is to copy and paste into Excel. The problem is, that all of the cells with numbers in them show up as text, and when I press F2, I find that there is a blank space at the end of each number.
Find and replace, searching for a blank space does not work - Excel "cannot find any data to replace". That function does work on cells in which I have created my own space at the end of a number, but not on these numbers. That leads me to believe that that "blank space" is actually some other invisible character that I need to be searching for. I've attached a bit of my data - maybe somebody else can identify my phantom character.
To get around this, I have been using the formula =(left(A1,len(A1)-1), and that works, it's just that it is a pain to create another table of 20-some columns with this formula, then copy those to values, then for each column convert text to columns to change the text to values, then search and replace for #value! where the original cells were blank.
I have a worksheet that I produced from optical character recognition, and there are a lot of funky characters that I need to get rid of. One is a line break or carraige return (I assume it's the same character that I could insert by entering ALT+ENTER). How do I search for this special character to replace it? How do I identify what that invisible character is?
View 2 Replies View RelatedI have very large text data which contains accented characters (E.g., "ÑÒÓÔÕÖÙÚÛÜÝàáâãäåçèéêëìíîïðñòóôõöùúûüýÿˆµ" etc.) within words.
Since I have several data sheets, some of which having 500000+ rows, Find and Replace and similar options are not viable.
I wish to replace each of these characters with regular English characters in all sheets. If that is difficult, these must at least be removed from the whole text. note that I need to preserve regular characters that are commonly used, particularly the hyphen (-) and underscore (_).
I am looking a macro which should perform below activities
I have a lists of suppliers which needs to cleansed....
1.replace all the special characters with a space
2.replace Corporation with Corp
Incorporation with Inc
Limited with Ltd
Limited partnership/ltd partnership with LP
Company with Co
ASSC/ASSOC with ASSOCIATION/ASSOCIATES (SEARCH SUPPLIER IN GOOGLE FOR THE CORRECT ONE)
MGNT with MANAGEMENT
SVCS with SERVICES
DEPT with DEPARTMENT
Unltd with UNLIMITED
Ctr with CENTER
UNIV with UNIVERSITY
3. Remove any text, Special characters and numbers after INC,CO, LTD, CORP,LLP, LLC
The macro should when I select any particular column... not restricted to column A
I have been trying to do the following but have not been successful. thanks in advance for helping!
- i have lots of text strings on one worksheet
- some text strings have <randomstring>, some even have multiple instances of <randomstring>, but others don't have a <randomstring> at all
- what i want is remove anything within "<" and ">", including the operators "<" and ">"
i have done this so far, with simple text functions, have each of the following lines in separate columns (text string column is "C"): .....
I need help with a formula (no VBA) that will find all the semi-colons ";" and pound signs "#" in a cell and replace them with this "<br> - ".
Example of Cell A1: ;#Red;#Green;#Blue;#
I started with this:
=REPLACE(MultChoice,SEARCH(";#",MultChoice),1,"<br> - ")
but it only replaces the first character.
I have a long list of items in one column, with parameters that are all split by an underscore.
However, in some instances, some of the text that is separated by an underscore needs to be joined together.
So for instance I'll have;
This_is_a_very_good_thing
This_is_a_perfect_thing
Where I want the result to be that "good_thing" becomes "good-thing" and "perfect_thing" becomes "perfect-thing".
How can I get this done with a Macro, instead of constantly doing a Vlookup to change this instances.
I basically want to find and replace certain characters in a formula, but the formula is quite intricate so I will give some background to the problem first:
I have a complex spread sheet which is used to check if a data array matches another data array (both data arrays are different sizes). One array has a set of parameters for a variable and the other array has the variables and the actual values for each variable. I have a section with the following formulas to check if the actual value (C121&D121) matches the parameters ($A$9:$A$108, $B$9:$B$108) & ($C$9:$C$108, $D$9:$D$108)
I have the following formula in cell AB121:
=(C121=INDEX($B$9:$B$108,ROW(101:101)-INT(ROW(100:100)/$D$1)*$D$1))
In cell AC121:
=(D121=INDEX($D$9:$D$108,ROW(101:101)-INT(ROW(100:100)/$D$1)*$D$1))
And have similar formulas from AD121 to AY121. I mention this to point out that excel regards this as an inconsistent formula, I haven't copied and pasted it over, I have had to re-enter it in each cell adjusting the parameter sections.
The problem I have is that currently this is set up to check through a data set and wrap around every 100 rows ('100' Entered in $D$1) but I want to adjust the formula when there is a different amount of rows to check. So basically the only way I can think to be able to do this is to have a formula or something in VBA (which I have very low level experience with) to be able to go into the formula and change certain characters within the formula. For example, if I wanted to check 95 rows instead of 100, it would need to have 95 in $D$1, which I enter in manually, but then how to go in and replace (101:101)-INT(ROW(100:100) with (96:96)-INT(ROW(95:95) in 2 sections in the 1 formula then do the same with the inconsistent formula from AC121:AY121?
I have about 40,000 lines in Column A that have text like so...
13HMPS32TRE600001OP000000601
13L9KUPSOTE600001OP000000601
I need a formula to change all TR and OT to characters QT. I did a find and replace but its changing other columns of text that I don't need changed.
I have a conversion issue. I have a sheet that is In Japanese (Shift-JIS) and some characters are replaced by boxes (squares), I have tried to record a macro to combat this, ie copy the symbols (squares) and replacing the squares with a corresponding letter. It works when I record the macro, but when I run the macro again it replaces everything with the letter I choose.
Sub replacing()
Columns("A:A").Select
Selection.Replace What:="??", Replacement:="RR", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
End Sub
It seems that the macro is not able to record the squares and replace them with R. see attached xlsheet.
Working on a macro to replace a list of about 20 specific "Special" Characters in excel, and have ran into 6 that will not work.. Following are the characters: ā, č, ć, ř, ş, ż
ActiveSheet.Select
Selection.Replace What:="", Replacement:="a", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Selection.Replace What:="", Replacement:="a", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
QUESTION: How do I check to see if a cell contains either "" or "/" and if it does then replace it with "-"? THE REASON: I have a form which needs to be saved in a particular directory with the name "Form 1 - client name - matter name". To do this I have put =("G:UsersCComplianceFile OpeningForm 1 - "&B7&" - "&D42) in Cell A1 and then in VBA added the following macro to a button which saves the file
ThisFile = Range("A1").Value
ActiveWorkbook.SaveAs Filename:=ThisFile
This works ok BUT, if the user puts "/" or "" in either B7 or D42, it won't save and throws up an error because you can't use those signs when saving a file.
I have list of email ids and some of which contains accented characters.I need to replace these accented characters with regular character.
Example:
rian.pieda@intt.com.cn
ario.sancez@acca.com
i'm looking for macro for find and replace characters in a locked sheet, if a cell contains for example Monday (First day of week)
I want with a command or macro to change the (First day of week) in (Top of the Week) like this Monday (Top of the Week)
i have 8 digit invoice numbers. Each 8 digit number starts with one of three 4 digit ID codes. Depending on the first 4 digits, I want a different "company" to show up.
First seems to work fine.
=IF(E6>"1NCC","North Carolina",IF(E6>"2ALA","Alabama",IF(E6>"3SCC","South Carolina")))
I have variable length strings, as shown in the sample cells below
TopographyTAB_FormatSP9200
TopographyTAB_FormatSP9400
OS_DataLandline
ITNTileTabTQ2286
I want to select any record where 5th and 6th character from the right hand end of the string which = either "SP" or "TQ". Where this is the case I'm then looking to truncate the string to remove the last 7 chacters.
None of what I have so far found using mid or right string appears to be particularly applicable.
I'm trying to remove everything after a specific character in a string.
I.e. change a website address to the hostname
http://www.excelforum.com/newthread.php
http://usa.excelforum.com/forum/new
to
excelforum.com
usa.excelforum.com
I'm using this formula, which strips the http:// and the www., but does not replace the characters after the first remaining "/" as the wildcard is not recognized.
=SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A2,"www.",""), A2,"http://",""), A2, "/*", "")
I'm importing data from the internet. The cell I'm trying to get is B8 on "Temp_Data" onto cell E3 on "Other Data". When it imports the cell into Temp_Data for some reason the cell expands, and I can't have that. I would manually copy and "Paste Special", text, into the proper cell, and that works. I can also copy the fist 7 letters in the string from B8 and paste them into E3. My code currently looks like this:
View 2 Replies View RelatedI'm having difficulty figuring out how i can Trim the last 3 characters from this string
Code:
FeatureCode1 = Split(errorChecker.lstErrorMessage.List(0), " [")(0))
I tried
Code:
FeatureCode1 = Left(Split(errorChecker.lstErrorMessage.List(0), " [")(0)), 3)
But that only SHOWS the last 3 characters... how i can just cut off the last 3 characters?
I'm guessing something to do with TRIM, but not sure how to implement it?
I am trying to count the characters in a string in one cell. For example, I want to count the number of "-"'s in the cell. The version number of part numbers is always the last two characters if the value contains at least one "-". However the parts have a non standard number of characters.
444444 = 0
444-44 = 1
44-44-44 = 2
There can be 0,1 or 2 "-" in the string. I can use the substitute formula to get the root part number, but I was wondering if there is an easier way. The raw data is from our ERP system, so I multiply the value by 1 to get a number if there are no "-" for the vlookup in another formula to work....
Is it possible to format a character in a string using vba?
For example if i had a string of GGGFF, and i wanted to make the G's appear as Green font and the F's as Red font.
I have a string like: AAJDGYE030000460. How can I remove the first character in a macro? I need to look at the second,third, and forth character
View 3 Replies View RelatedI have a set of data in column a that consists of email addresses. These email addresses all have underscores after them, ie "abc@hotmail.com_______". It will be a different amount of underscores everytime and I don't want underscores to be removed that are actually part of the address. I had been using the find replace function through vba, ie
Range("A:A").Select
Selection.Replace What:="_", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
however this ofcourse removes from actual parts of the email address. Is there a way to do this?