Extract Nth Word & Remove 1 Character
Jun 15, 2007
I have the function below from http://www.ozgrid.com/VBA/extract-words-function.htm
and have it working exactly as it's supposed to. Is it possible to adapt this to remove the last character of the text string, specifically the commas? My problem is that the raw data in one cell is like this (including commas) 0.333, 5.8874, 6.85423, 0.025. I separate each text string into separate cells but am left with the commas. I'm not using the "Data Text to Columns" option as I need the results in specific cells so they can then be used in calculations.
Function Get_Word(text_string As String, nth_word) As String
Dim lWordCount As Long
With Application.WorksheetFunction
lWordCount = Len(text_string) - Len(.Substitute(text_string, " ", "")) + 1
If IsNumeric(nth_word) Then
nth_word = nth_word - 1
Get_Word = Mid(Mid(Mid(.Substitute(text_string, " ", "^", nth_word), 1, 256), _
. Find("^", .Substitute(text_string, " ", "^", nth_word)), 256), 2, _
.Find(" ", Mid(Mid(.Substitute(text_string, " ", "^", nth_word), 1, 256), _ ............................
View 4 Replies
ADVERTISEMENT
Dec 28, 2013
My mission is to extract email addresses from cells. or I want any word that contains "@" in column A to be extracted in column B.
For example, if cell A1 contains: tracy jane@gmail.com , I want jane@gmail.com to be put in B1.
View 3 Replies
View Related
Nov 3, 2012
Junior Fit Softstyle T-Shirt
Antique Cherry Red
Junior Fit Softstyle T-Shirt
Antique Cherry Red
Softstyle T-Shirt
Antique Heliconia
Softstyle T-Shirt
Antique Heliconia
Softstyle T-Shirt
Antique Heliconia
This is column a and b. Looking at b I am looking for a formula that will pull the first capital letter out of each word like ACR to create color codes.
View 1 Replies
View Related
Nov 27, 2012
To all sifus out there, how can i transfer from these:
NAS517-3-2
-41353913
NAS517-3-5
NAS517-3-4
-42MS27253-2
-43353908
-44357182
To these:
NAS517-3-2
353913
NAS517-3-5
NAS517-3-4
MS27253-2
353908
357182
View 1 Replies
View Related
Jan 9, 2007
I am new to Excel and just starting with formulas. I am wondering if a formula can handle the following:
We have a column that has a url in each cell. Example (I removed the http:// before it so that all the words show up and it doesn't change to a clickable link):
i25.photobucket.com/albums/c54/bigbusy/S_Images/sylvantropicalbirdi.jpg[/url]
We would like to tell it to copy the portion after the last forward slash and until the period and put it in another cell. In the above example it would give us sylvantropicalbirdi. We then would want to append a _t to it.
Is this possible or am I just wasting my time trying to figure it out?
View 9 Replies
View Related
May 9, 2013
Is there a way of getting the first three character of every word or number in a cell ( seperated by spaces) ?
for example in cell E2 I have
BASE 150 WALL COLOUR GREEN
and would like it to read
BAS150WALCOLGRE
I have a approx a 1000 rows that I would like to do this with.
View 2 Replies
View Related
Aug 15, 2007
I have a cell in my worksheet with a fully qualified filename like 'D:abcDefGHIJklxyz123.app
I would like to extract only the xyz123.app. Obviously, the number of characters is going to vary based on the filename. The find and search functions appear to locate the cell but not the substring in the text. The right and left appear to work based on number of characters and in my case these are varying. Also, there does not appear to be any function that can do a search a string from right to left.
View 6 Replies
View Related
May 12, 2014
I have list like the below. I need to pull out everything before the space for each of these and after the _ which is after the CRN_, SA_ or MA_
CRN_212141 JRDC 7402-01_ICT-ICM IT Services Basel PDiv 3702 POPEnd 01/31/2015
MA_7500007822 JRDC
SA_GS-35F-4461G No Alias Determined
CRN_179764 Director of Administration and Managem PDiv 3799 POPEnd 06/30/2014
MA_N00189-09-D-Z044 USJFCOM Projects
SA_GS-35F-4461G No Alias Determined
Desired Results:
212141
7500007822
GS-35F-4461G
179764
N00189-09-D-Z044
GS-35F-4461G
View 2 Replies
View Related
Oct 11, 2009
I have a column that has various codes such as "E123" and "X456" and "S345". I just want to extract the numbers and leave the letters in each cell. How do you write a formula using the LEFT function to extract the last three numbers?
View 9 Replies
View Related
Aug 15, 2007
I have a cell in my worksheet with a fully qualified filename like 'D:abcDefGHIJklxyz123.app
I would like to extract only the xyz123.app. Obviously, the number of characters is going to vary based on the filename. The find and search functions appear to help locate the cell but not the substring in the text. The right and left appear to work based on number of characters and in my case these are varying. Also, there does not appear to be any function that can do a search a string from right to left.
View 5 Replies
View Related
Dec 19, 2007
I have as an example two products. One called PORAW VC and the other PORAW WC30
I need to extract from the 7th character (in this case) to the end of the string. The string length always changes and to complicate matters some products dont have a space in their name.
eg PORTP060DUS ( here I want to extract just the 060DUS )
PORAW VC (Just need to extract VC)
PORAW WC30 (Just need to extract WC30)
I suppose this is some sort of dynamic extraction
View 4 Replies
View Related
Nov 22, 2009
How to remove the first charcter that contains comma, like this :
,001,003,005 and i want the result is --> 001,003,005.
View 4 Replies
View Related
Feb 4, 2010
I'm trying to write a UDF that takes the text in a cell and returns text with a list of forbidden characters removed from it. At the moment I have the following:
View 8 Replies
View Related
Mar 7, 2012
I have a column and each cell in that column has information that ends with a comma "," I would like to remove that comma.
View 4 Replies
View Related
Mar 29, 2013
I am trying to remove the last character from some text with:
Application.SendKeys "{F2}"
Application.SendKeys "{BS}"
Application.SendKeys "{Enter}"
But when I do this, it is giving me the object browser in VBE . . .
View 4 Replies
View Related
Oct 25, 2013
I would like to take a value in a cell and remove the second and third characters in that cell.
For example: "V0010" would become "V10."
I've found formulas for removing the beginning and ending characters, but not a way to remove from the middle.
View 2 Replies
View Related
Apr 17, 2009
I need a VB script to remove a character.
The character is the SECOND . in the following strings
1.07.66
0.59.53
1.08.99
1.10.1
0.58.6
Basically, 1.07.66 represents 1 min and 7.66 sec, but I cant use the data until excel can recognise it as 1.0766
A vb sript would be nice, but a formula is also acceptable.
View 9 Replies
View Related
Aug 22, 2009
I have data in a column and each cell has an extra character at the end of it-
house;
farm%
school bus>
football-
trip to europe"
I once saw someone remove the characters with either a =LEFT( or =RIGHT( formula with a comma after the reference cell and some kind of FIND" " statement.
View 9 Replies
View Related
Oct 9, 2009
I have sentences which contains special characters (mentioned below) in a single column. I need to remove all special characters other than space. Could anyone help me on this...
!@#$%^&*()-_=+{}[]|~`?/,:;"
View 10 Replies
View Related
Aug 18, 2014
I need to extract the text located before last specified character () From C:PicturesPersonalChristmasDSC_00001.jpg ----> C:PicturesPersonalChristmas
I found a nice formula in another thread but that one returns the text located after the last "". The formula is =RIGHT(A1,LEN(A1)-FIND("@",SUBSTITUTE(A1,"","@",LEN(A1)-LEN(SUBSTITUTE(A1,"","")))))
View 2 Replies
View Related
Jul 24, 2007
Say for example I have ABCD-ABC12 basically an arbitrary length of alpha (A-Z) characters followed by an hypen "-" followed by another arbitrary length of alpha (A-Z) characters and then
immediately followed by an arbitrary length of numbers. (with no spaces between alpha and number)
How can I extract just the numbers from the group of alphanumberic characters after the hyphen
and set it to a LONG variable?
View 6 Replies
View Related
Feb 8, 2008
I am attempting to make a macro for. It requires me to scan a column of cells worth of data (characters) for parts of what they contain and place those parts into a variable or string so that I can use an IF statement to place text in another cell.
I used to know someone who could do this via VBA, but I have been unable to reach him.
This sheet is fairly basic. The cells to be scanned are all in one column, they are all four digit numbers and I need to read the first two digits into separate variables.
Example: If the cell has "4101" in it, I want to be able to read the first digit "4" into one variable and the second digit "1" into another variable.
This way I can place text based on either one of those digits into the next cell over with an IF statement and can enclose it into a large loop to do the entire column.
View 5 Replies
View Related
May 16, 2014
In column A, I have the following lines:
2014-05-15 02:08:43 @Centre INFO - CHANGE WORLD (Original World to Destination World)
2014-05-15 02:31:37 @Centre INFO - CHANGE WORLD (Original World to Destination World)
2014-05-15 02:37:19 @Centre INFO - CHANGE WORLD (Original World to Destination World)
2014-05-15 02:37:20 @Centre INFO - CHANGE WORLD (Original World to Destination World)
2014-05-15 03:07:19 @Centre INFO - CHANGE WORLD (Original World to Destination World)
2014-05-15 15:01:37 @Centre INFO - CHANGE WORLD (Original World to Destination World)
2014-05-15 15:04:46 @Centre INFO - CHANGE WORLD (Original World to Destination World)
I would like to use conditional formatting to highlight cells which have the same first 16 characters (yyyy-mm-dd hh:mm) before the "@" AND that contains the words "CHANGE WORLD". Therefore, I'm looking for a formula I could include in the conditional formatting so I can easily find the "CHANGE WORLD" that occurred at the same time (minus the seconds, they may vary slightly).
View 14 Replies
View Related
May 5, 2014
1) In any cell, I would like to remove "Area#xxxxxxxxx" (where x are random numbers).
Example : "INFO Log - [sys] Area#541185471Character#46545"
2) I would like to remove x characters before a word.
Example : 2013-08-28.txt@INFO
I would need to remove 14 characters before the character "@".
I tried to play with the LEN and RIGHT/LEFT formula but so far, I can't get it to work... The idea is to parse some text and remove the part in red (I was thinking about using SUBSTITUTE).
View 12 Replies
View Related
Sep 2, 2009
I need to remove the last character in a cell if it is a comma. I can't remove all commas because there are other commas in the text.
View 2 Replies
View Related
Feb 16, 2013
I managed to produce the following code. It removes the the last character in a cell if it is a slash But most of the time there are more than one slashes at the end. How can I take care of these?
Code:
For Each cell In Range("G2:G71")
If Right(cell, 1) = "/" Then
cell.Value = Left(cell, Len(cell) - 1)
End If
Next cell
View 4 Replies
View Related
Mar 26, 2007
How do I search for and remove the vertical lines in the above example from the column D? These things came when I imported a data file into Excel....
View 9 Replies
View Related
Dec 13, 2008
I'm trying to write to text file a HTML page that is in string variable sFullPage.
So far my code is like this:
Sub wrtHTML()
Dim sFName As String ' Path and name of text file
Dim iFNumber As Integer ' File Number
sFName = "c: est.html"
'Get an unused file number
iFNumber = FreeFile
'Create new file or overwrite existing file
Open sFName For Output As #iFNumber
'Write data to file....
How do I remove those first and last two marks (a double quote on each side + square mark from the end)? Do I use somehow wrong data types or wrong printing methods?
View 9 Replies
View Related
Mar 10, 2009
i need a formula that will remove the first 2 characters and the last character from the below, so below the result should be R0131644, the number of characters vary from row to row, they are not always 11
EUR01316441
View 9 Replies
View Related
Aug 21, 2009
I have data in cell A1 and A2 which looks like below
SECTOR - 11, HIRAN MAGRI, - 313001
MAIN BRANCH, 30-15-171 DABA GARDENS, NEAR SARASWATI PARK,-530020,
In cell A1 the number of hypens (-) are 2
In cell A2 the number of - are 3
What I am looking for is a formula which can remove all additional - except the last one. Therefore the result of the formula should be
SECTOR 11, HIRAN MAGRI, - 313001
MAIN BRANCH, 30 15 171 DABA GARDENS, NEAR SARASWATI PARK,-530020
View 9 Replies
View Related