FIND LAST Occurrence Of String
Nov 12, 2013
I understand that the function FIND(find_text, within_text, start_num) will find the first occurrence of a stated string. And by adjusting the start_num, you can skip a set number of characters before the search begins.
But, is there a way to find the Last occurrence of said string? In my case the find_text string may occur multiple times in the variable length within_text cell to be searched.
Sample: Find the last occurrence of MDU
Code:
Sample string1 - ABDJ FFU MDU WWW AEH JJF MDU JJI LLK OOI HAHA QWAS
Sample string2 - HFUR MDU HDS IGH RJR KDHF LLDE MDU KKJ MDU GGG
In the above 2 sample strings the output of the Find() function needs to be 26 & 40. Having a cell formula would be desirable, but if it can only be done by VBA that is acceptable, also.
View 9 Replies
ADVERTISEMENT
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
Nov 19, 2009
I want to grab everything left of the last occurrence of "." in a string, and in the next cell everything right of the last occurrence of "."
so say the string is 111.111.1.222
column 1
111.111.1
column 2
222
my current code (which works, but its messy) for the first cell is
View 3 Replies
View Related
Mar 14, 2007
I have multiple automatically updating data sets and I need to extract certain data to perform calculations on, this is the format of the data
SPLIT AB H 2B 3B
HOME 20 6 1 0
AWAY 20 7 2 0
SPLIT R HR RBI
HOME 2 0 1
AWAY 3 1 4
basically, what I need is to extract the data for home and away, and put them each on one line, no problem if this is always the format, but there are other lines of data that I don't need thrown in there at times which shift the data up or down
a simple vlookup will extract the first occurance of home, but I need another formula to extract the second occurance so I can have them all on one line and have the data as:
SPLIT AB H 2B 3B R HR RBI
HOME 20 6 1 0 2 0 1
AWAY 20 7 2 0 3 1 4
View 2 Replies
View Related
May 8, 2007
I need to find the first occurrence of the word grandsal after each employee details thru VBA. Is it possible to do that. If yes how to construct the if loops.
I take this time to thank all the members of the ozgrid for their exceptional.
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
Apr 4, 2007
I'm just new here as well as in Excel-VBA stuffs. I will appreciate if someone could help me. Here is the scenario. I have a data piled in a single column and different rows. Like this one:
spot.return
23,54,56..
532,677,755...
..
..
..
876,989,999;
spot.return
54,58,60..
..
..
spot.return
I need to select and copy all rows in between the occurence of "spot.return". There are a total of 80 occurences of "spot.return".
View 9 Replies
View Related
Feb 8, 2011
I am running EXCEL 2007 on XP. What is the EXCEL cell formula to put in a cell (for example"E5") that will reference the "last" occurrence of a specific text string in column A (For example Chard ) but will show its corresponding column B content (for example its PH number 3.45) regardless of the number of data entries that will be inputted in the future for both column A and B.
A B C D E
1WINEPH
2Chard3.24
3Merlot3.36
4Cab 3.44
5Merlot3.38 xxx
6Chard3.26
7Chard3.45
8Cab 3.41
9 Merlot3.33
10
View 7 Replies
View Related
Aug 14, 2014
I'm trying to extract all the numbers from the left of the delimiter ":" . They can occur once or more.
E.g. cell F2 contains BP2.2.1:40 BP2.2.1:50 BP2.2.1:60 BP2.2.1:70 BP2.4.1:80
and what i want as a result is : BP2.2.1 BP2.2.1 BP2.2.1 BP2.2.1 BP2.4.1.
I've tried =IFERROR(LEFT(F2,FIND(":",F2)-2), " ") but only displays 1 out of a possible 4 in the cell.
View 12 Replies
View Related
Jul 13, 2013
I am trying to find an in-cell formula to find a cell with a specific value and return the value in column A of the same row. Typically this is handled by Lookup or VLookup or HLookup. However, these only find the first occurrence of the value, I even know how to find the last occurrence, but what about in between? In my spreadsheet I have reoccurring values that I need the value in column A of the same row, but I need more than just the first or last but every instance in between. How to do this?
View 4 Replies
View Related
Apr 7, 2007
In one column, i get the ID. In the next column of the same row i get the status. My question is to find the number of occurrence of a specific ID with a specific status on another sheet. Attached worksheet sheet "count" has the source with ID at column C and status at column D. My expected result is in another sheet "expected result". I think a macro is needed, but i can't really figured out the way to do this counting.
View 5 Replies
View Related
May 30, 2012
This section of code I am working on requires me to find an exact text (I tried lookat:=xlWhole, but I can't get it to work right). The problem being is when it searches for Q1, Q10 is an acceptable answer ans so on. I need to get the 4th occurrence, but my research into Nth occurrence stuff is confusing.
The search is in a single column.
With Workbooks("FY12-Q3 Data Tables.xlsx").Sheets("PBA Crosstabs").Columns(1)
Set c = .Find(rCell, LookIn:=xlValues, lookat:=xlWhole)
Set c = .Find(rCell, After:=c, lookat:=xlWhole)
Set c = .Find(rCell, After:=c, lookat:=xlWhole)
Set c = .Find(rCell, After:=c, lookat:=xlWhole)
End With
View 9 Replies
View Related
Jan 7, 2013
I am working with a data sheet that holds a cell containing a number of position entries with each entry separated by a carriage return within the cell. I need to determine the entry associated with Accountant. The formula below determines if the entry Accountant exists and if so, displays 14 characters of information starting after the 12th character. The entry after "Accountant" is variable, but will have a carriage return at the end of the line. How can I identify the placement of the carriage return after the Accountant: entry?
=IF(ISERR(FIND("Accountant:",'Dynamic Report - WIP HDCI-Qu~01'!G7)),"",MID('Dynamic Report - WIP HDCI-Qu~01'!G7,FIND("Accountant:",'Dynamic Report - WIP HDCI-Qu~01'!G7)+12,14))
View 5 Replies
View Related
May 28, 2013
7900 Personnel:7980 PR taxes:7985 Medicare
I can use the FIND function to find the first occurrence of ":" and therefore select everything to the right of it, but how do I locate the second occurrence of ":"?
I want to segregate the 7985 Medicare. What if the data varies, i.e. some rows have one occurrence of ":" and others have two?
7900 Personnel: 7970 Bonus. I always want to segregate the last 4-digit account number and description.
View 6 Replies
View Related
Mar 19, 2008
I need a function that will do the following:
Look at the name in Column H2 of the current spreadsheet
Locate that name in Column H on worksheet 'Project Info' for the match with the most recent date in column F also on 'Project Info'
Return the value of corresponding column K on 'Project Info' divided by column I on 'Project Info'
Project Info has a header line so the data starts on line 2.
I don't know how to tell it to find the most recent date.
View 9 Replies
View Related
Jul 8, 2006
I have just been thrown back into programmng after a two year break so I am obviously rusty.
I have the following
Sub NumberOfReceiptFlowsAfterInitial4()
Dim my_cell As Range
Dim first_one As Double
Dim second_one As Double
Dim running_total As Double
Dim final_total As Double
Dim result As Double
I need something similar to this routine that will find the last occurrence of a cell that contains the value greater than or = 1%.
View 9 Replies
View Related
Feb 22, 2007
I've been working on my original problem and have gotten a little closer to the results I'm looking for but not quite there. Basically, I'm now running into a problem of only finding the 1st occurence in a range of cells when I want to find every occurrence and show the result. Also, the range of cells to look for in my argument has 2 criteria, the start date and the end date. Can anyone tell me if there's a way to search through a range of cells and return every instance of that cell even if it's duplicated?
I've also attached my project to better understand what I'm trying to accomplish which is the use of a Gantt Chart as an employee scheduler as opposed to a task (or project) scheduler.
View 2 Replies
View Related
Oct 31, 2009
I am writing a program which would look for look for the word " TOTAL" in sheet1 and then assign several values in sheet 2 based on cells offset of address of "TOTAL". This is repeated and down rows of sheet 2. Everything works except that it is giving repeating the first "TOTAL" address; i.e. it doesn't seem to go to the next met criterion.
Sheets("Summary").Range("A1").FormulaR1C1 = "=COUNTIF(Sheet1!C,""TOTAL"")" ....
View 7 Replies
View Related
Oct 1, 2008
I have a file that the user selects and when they enter a value (in this case, a job title) into the input box, my macro looks for the value in that file. If the value is there, a msgbox pops up that lets the user know that the value was found and it then goes to that cell, displaying in the next msgbox the cell address of where the value was found. I already have the code down for this part of the macro.
My problem is what happens if the file has the same value more than once. Ideally, I'd like to display a message box that returns the addresses of both cells with the same value and then prompts the user to select one of these values as the value they are looking for. I am not sure if a msgbox or a msgbox and then an input box are most appropriate for this situation. Once the user does this, the macro continues. The rest of my macro is built on the cell where this value is, so it is crucial that I make sure there is at least one value selected. Any help is much appreciated. I have included a sample worksheet of what this situation might look like.
Here is the code I presently have for this part of my macro.
Sub GetOpenFileName()
strFind = InputBox("Please enter the job title you wish to search for:", "Search for job title in this file")
If strFind = vbNullString Then Exit Sub
With Sheets(strSheetsMainCompProfile)
If WorksheetFunction. CountIf(Range(Cells(1, 1), Cells(100, 100)), "*" & strFind & "*") = 0 Then
MsgBox strFind & " cannot be found on this sheet"
Else
View 9 Replies
View Related
Dec 24, 2013
I'm getting an export from a CDR. This export contains the date and times people log on and off from a queue. For logging in they dial 511, for logging out they dial 512. They get a voice prompt and type their password. I need to know how much time they daily spend in this queue
At first this looks pretty easy. I just make a sum of all the times they called to 511, then a sum of all time they called to 512 and finally I substract those values and I end up with the correct time spend in the queue.
The problem comes when they call multiple times to 512 without actually logging off. For example, they type the wrong password or simply hang up.
Result is this in the CDR
FROM TO DATE TIME
101 511 23/12 08:34
101 512 23/12 11:58
101 511 23/12 12:34
101 512 23/12 14:45
101 512 23/12 14:47
101 512 23/12 15:00
The actual time spend in the queue is 5 hours and 50 minutes. But Excel calculates this as 35 hours and 22 minutes, because it counts the 512 values no matter what.
How can I make sure that Excel only calculates the values of they are either the last value in the row OR if they are preceded by 511?
View 2 Replies
View Related
May 23, 2006
I am having trouble getting my IF statement to test if the cell contains the text "sale" return "X" if not "Y". I need it to search through the text string in that cell and find a certain word, and if it finds that word, retrn a value. I am really having difficulty with is what symbol or function do I use for the logical test? (i.e. =, <>, MATCH, INDEX?)
View 4 Replies
View Related
Mar 31, 2014
I am trying to do a sort of index match thing using VBA. What I am attempting to do is to use the prefix of a long number and try to find that exact prefix in a string array, and output that string array value. So this is what I have so far as a test:
[Code].....
So I can match the text exactly so if I put PREFIXB in cell A1 in this example, i will get the msg box saying "YES", but if I make it PREFIXB1231k4j3jj1kj32cj, it will display "NO". I want to get it so that PREFIXB will be displayed in the cell that I put the formula in. So if A1 = "PREFIX1AAA100CF" and cell B1 = "=ABC(A1)", cell B1 will display "PREFIX1AAA".
Now the thing is that these prefixes can have different lengths, but will never encompass the exact prefix of another. So if I had a prefix of: PRE1AB, I won't have a prefix of PRE1A.
View 2 Replies
View Related
Mar 24, 2013
find the first numerical in a text string that is immediately followed by an x
so that i can extract the packing size from packing description workbook attached
DESCRIPTION
PACKING SIZE
SUNFLOWER OIL 12X1LT
12X1LT
[Code].....
View 5 Replies
View Related
May 6, 2014
i am trying to find country name in cell consisting of sting, i applied "=INDEX(K2:X2,MATCH(TRUE,INDEX(ISNUMBER(SEARCH(K2:X2,A2)),0),0))" this formula i am getting desired result but i am not able to apply ctrl+d since all cell reference are iterating.
View 8 Replies
View Related
Jan 31, 2008
I would like to call up a find box, then be able to search several worksheets for a string, to copy and paste the related row to a new worksheet.
I've gotten as far as being able to search for a string and get the row pasted, as long as the string is defined in my macro. Is there a way though to be able to call up a find box first though, and search for the input variable? (alternatively, I can only imagine a separate piece of code for each variable, of which there are many, and I am actually trying to save time.
View 14 Replies
View Related
Jun 16, 2009
The following line finds last "non-blank" row in a column. I have a column that has formulas in 10000 rows. Most of the time only first 7000 rows will have data, other cells below will have "". I need to find the last row with real data, not "".
Is there a way to add a condition or check to the following line?
View 6 Replies
View Related
Aug 2, 2009
1) Find strings "CA", "Ca", "ca", "California", "california", "cali", "Cali" in Column F
2) If the string is found, then record the Real value at Column D of that row in Column I
3) Continue this until there are no more strings in Column F
4) Add the values recorded in Column I and display the final value at the bottom of the list.
View 2 Replies
View Related
Feb 3, 2006
say I have a string that looks like this
C:Documents and Settingsme[test 2-2006.xls]Sheet1
I want to extract the DATE prior to .xls. I can get to this:
C:Documents and Settingsme[test 2-2006
It is possible that the filename would have numbers in it prior to the date.
I'm trying to figure out a way to get to the last SPACE in the string.
View 13 Replies
View Related
Dec 31, 2011
I would like to modify the macro below in order to find cells that do not contain */*/20*
How do I achieve this?
Code:
Sub delete_oldads()
Dim cel As Range, cfind As Range
ActiveSheet.UsedRange.Select
For Each cel In ActiveSheet.UsedRange
If cel = "" Then GoTo nextcel
Set cfind = cel.Find(what:="*/*/20*", lookat:=xlPart)
If Not cfind Is Nothing Then
cfind.Copy Cells(cfind.Row, "A")
cfind.Clear
End If
nextcel:
Next cel
End Sub
View 9 Replies
View Related
Mar 26, 2013
I know "Instr" find out whether a particular string exits. Can it also tell how many of that particular string appear in a text?
View 3 Replies
View Related