How To Find Nth Position Of Character In A String
Jun 12, 2014
I am trying to work out how to get nth position of a character in a string. For example in this
Code:
kjishdfiuayigdscka
if I use the formula
Code:
=FIND("i",I$1),
it will give me answer 3. But I want the position of 3rd "i" in the string. The answer should be 12. How can I change this formula to get the correct result?
View 9 Replies
ADVERTISEMENT
Jan 29, 2009
In cell A1 contains a string, how do I get the number of position of the last numeric character from right to left (this value will be in cell B1).
Example: 12543AR3372C31WWW (In Cell A1)
4 (In Cell B1)
View 9 Replies
View Related
Jun 29, 2008
on the web I've found this formula, which returns the postion of the last occurrence of the character in cell B1 in the string in cell A1:
=MAX((MID(A1,ROW(INDIRECT("A1:A"&LEN(A1))),1)=B1)*ROW(INDIRECT("A1:A"&LEN(A1))))
How do I turn this into a VBA function?
View 4 Replies
View Related
Jun 16, 2012
Title should read: Finding the nth Occurrence of a character within a text string
I have a very long text string that is delimited by about 50 "/" to segment certain values within the text string. I want to be able to extract the text between the 33rd and 34th occurrence of "/". How to do this?
View 5 Replies
View Related
Jul 11, 2014
Is it possible to find the location of different characters in a string (using VBA)? Normally I would use InStr of InStrRev option in VBA but my situation is a little more complicated.
The character I am looking for is not always the same, sometimes it is a , or a . or a : or a "blank" etc
I tried to do it like:
dim strChar as string
strChar = "[,.? /]"
SearchPosition = InStr ("cell location", strChar) (searchposition is the name of the function I am trying to make)
This works if I define only 1 character, this way it gives me a 0 as outcome
I have tried to change it to strChar = "[,]" or strChar = "[.]" or strChar = "[ ]" but this doesn't work.
View 13 Replies
View Related
Jun 11, 2014
I have a cell that has approx 22000 characters. I'm trying to remove a specific character string from a cell by doing a find and replace with "". It works for characters in the first part of the cell but not for characters in the last part of the cell.
Example: I do a find/replace for the characters 21242 to "" in column A and I get the expected results. I do a find/replace on 69294 to "", again I get the expected results, but if I do a find/replace on 85203 to "", I get "Excel cannot find what I am searching for" (but its there!)
My cell size is within the max size of 32,767 characters so not sure why its not working.
Attached a sample worksheet.
View 5 Replies
View Related
May 23, 2007
I would like to find the position of the last occurrence of a character in a string. For example, I have a string with the following:
"c:wwgpeToolbidsTest File.GP$".
I would like to find out the position of the last '' in the string because I want to pull the filename, 'Test File.GP$' into a variable. I would like to avoid writing code to do this. Are there some Excel functions I can use for this?
View 7 Replies
View Related
Jan 22, 2009
I have a macro that asks the user to enter a file name and have written a small function to search the name given to the file to find any invalid characters, trouble is I must be doing something wrong as I doesn't work. Everytime I write something in the box I'm told it's invalid, regardless of weather it actually is or not.
Function -
View 7 Replies
View Related
May 8, 2008
How do you find if the last character in a string is a quotation mark?
View 9 Replies
View Related
Feb 14, 2010
I am reading lines from a textfile. Each line in the textfile has the identical format: textstring1:textstring2. The two strings are always separated by the : character. I have the code to get textstring1, but because I'm a rookie, I can't figure out how to get textstring2. See the code in bold, this is the line I need to get textstring2.
View 4 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
Mar 6, 2009
I have some cells with some spaces and then text where I want to find the position of the first letter. Do any of you know about any function I can use?
The example below contain 5 spaces and then my name. It should give me the answer 6.
" Magne"
View 8 Replies
View Related
Aug 6, 2013
Let's say we have a text string in the excel cell: 12.123.12.1
Is there any way to get the latest dot's position using excel's functions?
View 2 Replies
View Related
Mar 9, 2014
How to find and show position number? I try merged two function, but doesn't work
1º=FIND("0";B2)
2º=FIND(CHAR(1);SUBSTITUTE(B2;"0";CHAR(1);2))
Number
Position
[Code].....
View 5 Replies
View Related
Sep 1, 2009
I have a text string in a cell, something like:
000024AC1011.
I need to find a way to find the first nonzero character in the string, and what position it is in. For instance, in the above example, 2 is the first non-zero character, so the function would return 5, since the 2 is the fifth character into the string.
View 2 Replies
View Related
Apr 24, 2006
why this code only works till the first assignment?:
Dim pos As String
Sheets("Sheet1").Select
pos = Range("A1"). Find("John").Address
pos = Range("A1").Find("Mary").Address
pos = Range("A1").Find("Peter").Address
In the second assigment
pos = Range("A1").Find("Mary").Address
I get a "Object Variable or with block variable not set" error message.
View 3 Replies
View Related
Sep 11, 2012
I have been confronted with an issue that has bugged me: Now do I extract a part of the string according to lets say "markers"?
Here is what I mean:
I use the code below to get the bottom range of my tables:
Code:
blimit = Activecell.Address
I haven't had problems because my tables were small, then I would:
Code:
blimit = Right(blimit, 3)
If the table was small there was no problem, since lets say the Activecell.Address = "$C$123", resulting in blimit = 123.
My how do I extract a part of the string, knowing I have 2 "$" ? That way I would make a version of this that always works.
I cannot use FIND or any formulas I am aware of since they all start counting from Right to Left... I thought of using Replace() to get the first "$" and change it for something else like "-" then looking for the second "$". But Replace() basically changes both signs... making my idea... well obsolete...
View 2 Replies
View Related
Oct 15, 2013
I have a choice of 9 command buttons on a form that enter a short string of text into a textbox. Each button enters a different string into the textbox. The string is the prefix to a product serial number. Once the user has clicked the button & entered his preferred prefix I would like the cursor to be flashing after the last character ready for the user to manually type in the remainder of the product serial number. I'm guessing (with my limited ability) that I have to create a function to do this & then call the function when the button is clicked ?
View 1 Replies
View Related
Apr 10, 2014
Now do I extract a part of the string according to lets say "markers"?
Here is what I mean:
I use the code below to get the bottom range of my tables:
Code:
blimit = Activecell.Address
I haven't had problems because my tables were small, then I would:
Code:
blimit = Right(blimit, 3)
If the table was small there was no problem, since lets say the Activecell.Address = "$C$123", resulting in blimit = 123.
My how do I extract a part of the string, knowing I have 2 "$" ? That way I would make a version of this that always works.
I cannot use FIND or any formulas I am aware of since they all start counting from Right to Left... I thought of using Replace() to get the first "$" and change it for something else like "-" then looking for the second "$". But Replace() basically changes both signs... making my idea... well obsolete..
View 2 Replies
View Related
Jun 27, 2006
I'm looking for some VBA code that would look at a column of data, look at each cell value in that column and if the cell value starts with the letter 'G' and the 5th character in that cell is not 'Z' or 'X' I would like to highlight that cell. Example:G123-123 would be highlighted whereas G123Z-123 would not.
View 4 Replies
View Related
Jan 3, 2007
I would like to get the nth character from a string. For example, let's say there is a string "jupiter", and I would like to get the 3rd character of this string, "p". Is there a function in excel vba that would allow me to do this?
View 9 Replies
View Related
Feb 17, 2014
I have this data and want to extract the character after the letter Y if the string has a Y in it.
Example data Output
AU 2013 OD ANR B24 Y2 2
AU 2013 OD ANR B24 Y4 4
AU 2013 OD ANR B24 Y5 5
AU 2013 PD HLD NOV B SPA
AU 2013 PD HLD NOV C SPA
AU2013OD ANR B25 Y1 1
AU2013OD ANU B25 Y5 5
AU2013OD WCR FPVN B49
AU2013OD Y6 FPVN B49 6
AU2013OD WCR FPVN B40
AU2013OD WCR FPVN B43
View 6 Replies
View Related
May 30, 2014
I want to assign a value to a character or string
Like I have formula p2p3= (n-1)*p +(2*e)
I want to assign values(number) to n,p,e.............so that i can get p2p3....like want to assign 'n'=4
I don't want to use cell number for calling values of n,p,e
View 1 Replies
View Related
Feb 11, 2010
How can I evaluate just the first part of these stirings so I can just do something like Left("Ca",2)?
View 2 Replies
View Related
Jul 28, 2008
How do I split the below character or similar strings into 2 columns of 25 characters each without cutting a word off?
BONE CURETTE-RVERSE ANGLE 5.5MM WIDTH-MEDIUM/BAYONETED
View 14 Replies
View Related
Feb 9, 2012
I have a web query that returns a city and state, but the last character of the state is lower case. I need VBA code to change the last char to upper case. Here is what I have so far:
Code:
tmp = Cells(4, 1).Value
Mid(tmp, Len(tmp), 1) = UCase(Right(tmp, 1))
Cells(4, 1).Value = tmp
Is there any easier way to do this without 3 lines of code?
View 2 Replies
View Related
Dec 21, 2012
I have some columns in the excel file:
/path1/xyxxx/cccccc/filename12.txt
/path1/bxgdgg/gfdfacc/filenameeee8.txt
/path1/tttwrw/ccefecc/ddddd/filename56.txt
And I would like to delete everything before the LAST slash(just filenames)
filename12.txt
filenameeee8.txt
filename56.txt
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
Sep 23, 2009
The barcode lablels all have the following format: A318639....that is a letter followed by six numbers.
When I scan the barcodes into any cell, a dollar sign "$" appears in the front of the barcode string that is entered into the cell. The dollar sign is not a relevant part of the string of characters in the barcode label.
What I am looking for is a solution where upon scanning a barcode into any cell, the dollar sign is removed from the front of my string and I am left with just the seven character string which is shown above.
I have experimented with the Data Validation tool by trying to limit the number of characters that are allowed in a cell to seven characters, but that has not actually removed any characters from my data string.
View 9 Replies
View Related
Jun 10, 2009
For icount = 1 To LenComputername
valComputername = Asc(Mid(UserComputername, icount, 1))
Next icount
If the computer name is NAMTOK-PC Then the LenComputername is 9. Does that mean then that the valComputername is equal to 78?
View 2 Replies
View Related