Strip Unwanted Characters From Text String
Sep 8, 2009
Is there an Excel function that can strip a specificed unwanted character from a text string to leave all the other characters excluding the unwanted one?
e.g. if the original text strings were (in separate cells within a workbook):
C-2C-9C-9-XA-10A-10-BA-10-XA-8N-7-D
The function would strip the "-" to leave:
C2
C9
C9X
A10
A10B
A10X
A8
N7D ...etc.
View 9 Replies
ADVERTISEMENT
May 13, 2008
I have a macro running this code to strip out unwanted formulas and formatting.
Sub Quote_Wrapup()
'To stop screen flicker
Application.ScreenUpdating = False
Range("CDandC").ClearContents
Range("qdata5,qdata6").Font.ColorIndex = 2
'To delete delivery address lines if 1st line empty
If IsEmpty(Range("deliver_line1")) _
Then Sheets(1).Range("deliver_rows").EntireRow.Delete
'No End If required as only one action as a result of the If
Range("Item_Nos").SpecialCells(xlCellTypeBlanks).EntireRow.Delete
Columns("A:E") = Columns("A:E").Value .........................
A spreadsheet based on my template has been sent to me because the macro won't run properly. When I try to run the macro I get a Runtime Error '1004' Method 'Range' of object '_Global' failed on the following line. Columns("A:E") = Columns("A:E").Value.
View 4 Replies
View Related
Jan 13, 2014
I've a column of data as below:
ROACH (#21)
SHARK (#11)
SHARK (#13)
UNICORN (#26)
ROACH (#20)
TRIGGER (#09)
UNICORN (#06)
UNICORN (#09)
UNICORN (#11)
VIMBA (#03)
VIMBA (#04)
TRIGGER (#06)
ROACH (#07)
ROACH (#08)
ROACH (#10), UNICORN (#24)
What I need to do it to strip off all the characters after the first space.
I assume I can use FIND and then LEFT, but how to I put this into a Macro?
View 4 Replies
View Related
Jun 20, 2014
I want to strip only the leading set of numbers from a string. Trailing numbers should stay.
Logic rule would be:
1) Find first Alpha character
2) Remove all numbers prior to this position
Code:
Original string Desired string
42114DEP DEP
050114OP2OP2
0514OPOP
050214BKCKSBKCKS
05214CKCK
0502CKSCKS
050214CKS-3CKS-3
050214CKSACKSA
050214OPOP
50214PSCASH1PSCASH1
050214PSCKSPSCKS
0502SALES SALES
View 9 Replies
View Related
Nov 9, 2006
i want to convert an excel spreadsheet into a text file, keeping the same format, but when i do so, excel puts " " around the characters, which i don't want. Example: please see the 2 attachments.
e.g. when i convert, i don't want the " " around the commas in the text file.
View 6 Replies
View Related
Nov 17, 2007
How I can change this formula to find the first 3 characters of a text string?
Instead of using numbers in column A, it will be Names, I need the user to enter only the first 3 characters of the name and then display the results, (Meaning that all others irrelaavnt rows will be hidden.
Sub myHidingRoutine()
Dim foundCell As Range
With ThisWorkbook.Sheets("Sheet1")
Set foundCell = .Range("a:a").Find(What:=.Range("a2").Value, After:=.Range("a2"), _
LookIn:=xlValues, LookAt:=xlWhole, SearchOrder:=xlByRows, _
SearchDirection:=xlNext, MatchCase:=False)
View 9 Replies
View Related
Apr 3, 2009
I'm trying to pull text out of a middle of a long string of data located within one cell. The string is not always the same size and the text I need to pull out is not always in the same spot
For example - in this string
source=google&adgroup=Jimmy Bop (Broad) >>/yes/klingon/GetStarted.aspx >>/finace/success.aspx?
I want to pull out the text "Jimmy Bop (Broad)
It will always be between "adgroup=" and ">>/" (although sometimes the character ">>/" will appear multiple times within the string.
View 9 Replies
View Related
Apr 28, 2009
I am looking for a formula that will remove any unwanted characters in a cell.
For example i may a word or string of words with "-" , " ' " or "," in them and i would like to have these removed.
View 2 Replies
View Related
Jul 9, 2009
I'm needing some code that will remove an open quotation mark from the numerical value found in column A. This will be for every row with a numercal value.
example problem: "360015
example answer: 360015
All numbers will be 6 digits
And I've got another issue with numerals in column C. To the left side of the Cell there maybe a Number or Letter. To The Right side of the cell
there will be a single or double digit number. Both will be separted by some space (6-8 spaces). As in the examples below:
(again what you see on each line is in one cell in col. C.
R 59
E 6
0 4
I need the value on the left side of the cell to be moved concenate/merge with the values in column B.
There's will be approx 2000 rows that will need to be checked for this occurrance. Since there's so many rows,
I'd really would like to use VBA and not formulas to accomplish this.
View 4 Replies
View Related
Aug 6, 2009
I'm having the following little problem, and i'm hoping that
someone here can help me solve it.
I have a number of rows containing data starting at row 1.
I already made VBA code which finds the last row containing data.
That row number is stored in the variable "LastRowWithData".
What i want to do now is the following.
In column B (in row 1 to the row number stored in "LastRowWithData"),
there are long code's which all have to be checked for unwanted characters.
Some of these unwanted characters are the "I" and "O" characters both in
upper case and lower case.
If these characters are found a messagebox has to appear, saying something
like "Illegal character found in cell ____".
If more than one cell containing unwanted characters are found, either more
messageboxes with the cell coordinates have to be displayed or one messagebox
displaying all the cell coordinates in which the unwanted characters are found.
Im planning to use a while - wend statement to check all cells for unwanted
characters. (While ActiveCell.Row LastRowWithData)
Is there a simple way to do this in (Excel 2003) VBA ?
View 9 Replies
View Related
Jun 20, 2007
I have a spreadsheet that i manually edit each and everyday e.g.
A B C
EABGL/UD NDT254892
MRMR/RUS/ELQNS259762
LSL/UW/B LQNS267259
WWEX/UQ bbr263666
LWL/KL/B 270407
MYTCJ/UB NDT271774
LNL/SB/UB HLC - 271955
SMMQD/WT HLC - 269516
EACO/TN/UGBBR257827
NILVA/UC EUi273645
For everything that doesnt equal EM, LN, LW and TH in column A, everything should be deleted in column B.
For the remaining EM, LN, LW and TH, i would then like it to delete / (forward slash and all characters after this) so that this would make my life easier.
View 4 Replies
View Related
Dec 14, 2013
I have the data string below:
Career:25: 1-0-2 $13,765
I would like to extract the 1 between the : and - and as a seperate extraction would like te 2 between the - and the $ I have tried a few things but end up with the - as the length of the data changes
View 5 Replies
View Related
Aug 24, 2006
If 'a' is a string that contains x number of characters, how do I find out what x is (in VBA)?
View 2 Replies
View Related
Feb 25, 2007
I have an excel sheet with approx 30,000 rows of data.
These are all keyword phrases.
They can be related to any subject, but for this example these are related to the root keyword phrase of "car Rent"
I have some software which basically pulls in keyword phrases from search engines and meta tags etc, including misspelled keyword phrases.
My problem;
The data is uncleaned.
In other words there might be I think it's called "Carriage return" data in there, so the row of data might be very deep (Instead of a row height of say 10.5 it could be anything, IE some could be 100 or 200 even).
There are unwanted characters, for example; ()[]{}+?!""^*
(If it could delete all unwanted characters except for letters/digits)
There is a problem I see, that if it removes _ or - between words, that it will join the words together which won't be of any use. If it deletes anything with a letter either side of it or a letter and digit, or 2 digits, 1 either side it would then need to add a space to replace the hyphen.
So for example; if there was a phrase in the list like ....
View 9 Replies
View Related
Feb 9, 2013
The problem - I'm trying to find a formula that will find text between 2 characters with unlimited instances in a single string and combine the found text to a single string. The character enclosing the text i'm after will likely be a % symbol. This formula would then be replicated down 5000-10000 rows.
eg. 1 - This is %an% example %sentence% to show what I %am% looking for
eg. 2 - This %is another% example of what I %need%
eg. 1 answer - ansentenceam
eg. 2 answer - is anotherneed
Ideally this would not use a macro as it will be applied to an ever expanding data set but I realize that may not be possible.
View 3 Replies
View Related
Aug 12, 2011
I've scoured the internet for this answer and have not found a formula that works.
I have a list of domain names/URLs in column A of workbook 1:
jhjh.com
hajfh.co.nz
123.123.12.12
I have a list of domain name extensions in workbook #2:
.com
.co.nz
.net
I want to determine if the cells in column A workbook one contain any of the strings in workbook 2 - note that I need to look at the string, not the entire cell in workbook one. If there is a match, true, if not, false for that cell within workbook one.
It's sort of a reverse array lookup with text. It seems that cross workbook and text is what causes the challenge.
View 9 Replies
View Related
Dec 22, 2013
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)))
View 3 Replies
View Related
Sep 17, 2007
E122112 David Hall
Robert Townsend
Micheal Keel
Tanya Smith
Elizabeth Charles
E004587 Andrea Tummings
The problem is for those names that come thorugh with the Letter and than the number...I don't need the names like that....I would like a Macro that would look at each cell in column A and remove that from those selected cells. I would like my result to look like this...
David Hall
Robert Townsend
Micheal Keel
Tanya Smith
Elizabeth Charles
Andrea Tummings
View 9 Replies
View Related
Feb 8, 2007
I have 1800 rows of bibliographic entries that are I am cleaning up. The first column imported with some numbers and spaces that I don't want. Here is an example of the variation:
Abdalla, C.W.,
37 Abdalla, C.W., B.A. Roach, and D.J. Epp,
2 Abou-Ali, H and M. Belhaj,
I want all the rows to be like the first one, ie, no numbers and no spaces.
View 9 Replies
View Related
Jan 19, 2010
After doing some searching I found a macro here which imports multiple text files into one workbook, keeping each text file as a seperate worksheet, each worksheet named the same as the original file name (minus the .txt extension).
However, it adds a blank line between each line of text. So I get this:
Pinging 172.27.133.29 with 32 bytes of data:
Reply from 172.27.133.29: bytes=32 time=232ms TTL=62
Reply from 172.27.133.29: bytes=32 time=62ms TTL=62
Reply from 172.27.133.29: bytes=32 time=65ms TTL=62
instead of this:........
Pinging 172.27.133.29 with 32 bytes of data:
Reply from 172.27.133.29: bytes=32 time=232ms TTL=62
Reply from 172.27.133.29: bytes=32 time=62ms TTL=62
Reply from 172.27.133.29: bytes=32 time=65ms TTL=62
This doesn't happen when I use the import wizard, or when I just open the file from the File -> Open menu.
My text files are always the same format (number of lines, etc.), so it's easy to delimit and insert forumlae as needed, but those extra lines are breaking a macro I've previously written to parse the data.
View 9 Replies
View Related
Feb 17, 2014
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")))
View 3 Replies
View Related
Feb 24, 2014
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.
View 9 Replies
View Related
Dec 26, 2009
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, "/*", "")
View 11 Replies
View Related
Feb 11, 2009
Replace characters in a string. I have this macro:
View 2 Replies
View Related
Feb 21, 2010
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 Related
Aug 21, 2012
I'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?
View 3 Replies
View Related
Dec 30, 2008
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....
View 9 Replies
View Related
Dec 22, 2009
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.
View 9 Replies
View Related
Nov 16, 2006
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 Related
Dec 21, 2006
I 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?
View 6 Replies
View Related