Sorting Rows On Whether They Contain A Specific String
Sep 7, 2009
Lets say I have a 2 column sheet (A and B). And I want to sort on column B with all the rows that contain a given string, i.e. /g or Äåßôå.
Something like doing a find all but then being able to select/copy/cut etc those rows.
How can this be done?
View 11 Replies
ADVERTISEMENT
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
Jul 13, 2012
I have a table of data which I need to put in numerical order automatically (i.e. as if I were to use a formula in excel).
The table is located in cells Z157:Z264, and I would like the results to be output in cells Z45:Z152.
I know you can do this manually using the "Data" > "Sort" tool in excel but I could do with a formula for it really.
View 1 Replies
View Related
Jul 31, 2014
I have a spreadsheet with column headers like, "Date" "Phone number" "Name" ect., and rows of data below. Each of these rows contains data pertaining to a prospect employee, as the purpose of the spreadsheet is to keep track of job applicants. One column is used as a 'Recruiter Sign-off' area, where the recruiter who processed the application inputs their name:
Example.png
I'm trying to automate a variation of excels sort function. However, I don't want to sort 'From A to Z.' Instead, I want to have the rows of data sorted with the 'Recruiter Sign-off' column used as the sort Key, and a selected name (of one of the recruiters) used as the sort Criteria.
I already have a userform that allows the user to select a name from a listbox. When they press confirm, the name is stored in a Public String variable, (selectedRecruiter). I'd like then like to have the rows below the column headers to be sorted based on the selected name. Example: User selects the name "Jon" from a list. The application then brings all of the applicants that 'Jon' has signed off on (those rows that contain his name) to the top rows of the range.
The workbook is shared, so I cannot use tables.
I found a code that accomplished what I want, however it also leads to a horrible system crash after a few times running it (BEX crash).
[Code] ..........
View 3 Replies
View Related
Mar 16, 2008
I have a sheet named: tool
In this sheet I have a long list of data that i would like to have sorted out on different worksheets that needs to be created by the macro. The deciding factor for the sorting are found colum B. In this colum there are different text strings. I would like for the macro to look at this text string and copy the entire line over to the respective work sheet. the work sheet needs to be named according to the text string in colom b.
Furthermore in the sheet named tool the first 3 lines are headings and i would like all of these transfered to each of the new sheets.
View 9 Replies
View Related
Mar 1, 2014
I have found a list of newspaper in an excel file and at the end of the text it is written the name of the language e.g Bangladesh News 24 (Dhaka) [In Bangla], The Bangladesh Monitor [In English]. I would like to distinguish the names ended with [In Bangla] and in [In English]. How can i distinguish this two different type of data with VBA?
View 1 Replies
View Related
Jan 7, 2014
I'm trying to figure out a way to group columns in a bar graph without displaying them in a cluster, but instead in displaying them individually in a specific order. However, I still want to identify each group with a different color. This is hard to describe, so I'll try my best to illustrate what I'm trying to do with an example. Assume I have three groups of data and within each group I have 2 to 3 items in it with different values. In a list the data would look like this:
Group 1 - Item 1 - $2,000
Group 2 - Item 2 - $1,100
Group 1 - Item 3 - $2,200
Group 1 - Item 4 - $3,200
Group 3 - Item 5 - $1,800
Group 2 - Item 6 - $1,200
Group 1 - Item 7 - $2,500
Group 3 - Item 8 - $2,800
What I want to do is create a bar graph that will still allow me to color all group 1 items as red, all group 2 items as blue, and all group 3 items as green while still showing each bar sorted in the order I've shown above and labeled as items 1 through 8. Then, I want a legend to only show the groups 1 - 3 with their colors. To explain, the graph would look like this:
Bar 1 would be labeled as Item 1, with a value of $2,000, and colored red
Bar 2 would be labeled as Item 2, with a value of $1,100, and colored blue
Bar 3 would be labeled as Item 3, with a value of $2,200, and colored red
Bar 4 would be labeled as Item 4, with a value of $3,200, and colored red
Bar 5 would be labeled as Item 5, with a value of $1,800, and colored green
Bar 6 would be labeled as Item 6, with a value of $1,200, and colored blue
Bar 7 would be labeled as Item 7, with a value of $2,500, and colored red
Bar 8 would be labeled as Item 8, with a value of $2,800, and colored green
Then, the legend would only show the groupings of Group 1, 2, 3, 4 and their associated colors.
(By the way... I know I can do this manually by selecting each bar and customizing the color, but I want an automated way of doing this to reduce maintenance time)
View 1 Replies
View Related
Dec 7, 2013
I have an excel database that contains a code to identify specific people.
NAME ADDRESS PHONE CODE
Jones 3 Quay St, PN 063586954 JU79N4
White 24 Dyk St, PN 063547786 9GVJ64
Smith 9 Random St, PN 063512698 4LN867
Butt 89 Yeah Pl, PN 063569986 D920HK
Handle 69 James Ct, PN 06 3549687 ZK26S84
If I wanted to filter the list so I only had codes that had Z, N, H in it. How do I do that??
View 5 Replies
View Related
Dec 10, 2007
Currently I am using the Kickbutt VBA Find Function of Aaron, but I would like to have something that works more efficiently. What I currently do is (assuming all possible values for Column J are A - F):
Find_Range("A", Columns("J"), MatchCase:=True).EntireRow.Delete
Find_Range("B", Columns("J"), MatchCase:=True).EntireRow.Delete
Find_Range("C", Columns("J"), MatchCase:=True).EntireRow.Delete
Find_Range("D", Columns("J"), MatchCase:=True).EntireRow.Delete
Find_Range("E", Columns("J"), MatchCase:=True).EntireRow.Delete
although I just want some code that says: delete all rows except those that have "F" as content in Column J. I already tried something like:
Range("1:65536").Select
For Each cl In Range("J:J")
If cl.Text = "A" Or cl.Text = "B" Or cl.Text = "C" Or cl.Text = "D" Or cl.Text = "E" Then
Rows(cl.Row).Delete
End If
Next
but it also takes much to long. The major problem I think, is that the number of records is variable so I search the entire worksheet...
View 5 Replies
View Related
Jun 17, 2014
I was having trouble on getting a text string within a sentence..
Example:
In column A1:
1 - AMERICA 85 - 90 2 - CHINA
So I want to get only the 85 - 90 and it will shows on column A3..
View 9 Replies
View Related
Nov 14, 2008
I'm running Excel 2003 on Windows 2000. I'm working with a worksheet that is about 10,000 rows long and 25 columns wide. The first and second columns all have data in them, and the third through twenty fifth could have data. From row to row, if there is data present it will be in columns from left to right. By that I mean that if there is data in four columns of a particular row, it will always be in columns 1-4, not spread out throughout the 25 columns.
What I'm trying to do is sort the data in each row so that values ascend from left to right. Here's a very simple version of what the data looks like:
A B C D E F
1 a 6 3
2 b 5 9 2 8
3 c 6 5 2
4 d 9
5 e 3 9
When I'm done I would want the data to look like this:
A B C D E F
1 a 3 6
2 b 2 5 8 9
3 c 2 5 6
4 d 9
5 e 3 9
[url]
View 9 Replies
View Related
Jun 4, 2009
how do I cut rows and paste into another sheet/file based on the values in a row.
For example in row A
A
1 123
2 123
3 123
4 333
5 333
6 444
7 333
8 444
I need to copy all the 123 into a sheet/file and the 333 into another sheet/file.
View 9 Replies
View Related
Aug 3, 2009
I have a string in one of the following formats:
Banana 2, Orange 5, Lemon 0
Banana 7, orange/Lemon 9, cucumber 6
Melon/grape 3, Pineapple/ Orange 1
Banana 1, orangefruit/Lemon 2, pine 8
I would like to take out the first integer that comes after the word Orange (not case sensitive). I'm kinda at a loss here, how do I go about accomplishing this?
View 9 Replies
View Related
Oct 25, 2012
How does one extract a specific sting/words from each cell? Especially if [formatted data] varys in characters (not suitable for regular LEFT, MID, RIGHT functions use).
Sample Question.xlsx
View 3 Replies
View Related
Jan 28, 2014
I'm using the code snippet below to add text and apply formatting to a cell within a given sheet.
[Code] .....
I'm now trying to amend this so, the word "All" is in bold text and I've recorded the a macro, and have the following:
[Code] ....
The problem is, is that when I try to amalgamate the two, I'm unable to get this to work.
View 8 Replies
View Related
Feb 12, 2009
I want to delete a specific words from string but i have a problem with the code below. For example, i wan to delete the word "Inc" only but the problem with my code is that it is deleting from "Incorporated" too and i want only the code to delete only if it finds the word "Inc" only.
View 11 Replies
View Related
Oct 12, 2009
I have absolutely no idea how to get starting on this one. I've got a long string in cell B1. At some point there is the word "oms:SomeString," (without the quotes). I need to know whether SomeString is somewhere in the active sheet or not (the workbook running the VBA-code is not the active sheet). I can't just compare the cell B1 because it contains multiple words. Any hints are very welcome.
View 3 Replies
View Related
May 28, 2012
I want to filter columns from an excel spreadsheet where the value in the cells contains/includes the String "Create".
View 3 Replies
View Related
Nov 24, 2006
I want to search a string for specific characters.
f.e. Begin = "bfPaa2"
I want to look for "P"
So, the answer has to be: Letter = "P" after searching the string
View 9 Replies
View Related
May 27, 2009
I need to refer the LAST ROW OF COLUMN "D" to appear in the message box for the below code along with " Receipt number" which is in Sheet2.
Sub saveit()
With Sheets(2)
r = .Range("B65536").End(xlUp).Row + 1
InvN = Cells(15, 4).Text
If Range("c18") = "" Or Range("c20") = "" Or Range("c20") = "" Or Range("c24") = "" Then
MsgBox "Please fill all required fields", vbCritical, " Missing data"
Exit Sub
End If...............................
View 9 Replies
View Related
Sep 5, 2009
In one column I have different objects separated by a comma. I need to select one of these: 11,20,30,60,61 and copy it into another column. I have used this
For counter = 0 To not_empty_cells
For counter_dep = 1 To 5
position = InStr(1, (Cells(counter + 3, 4)), department(counter_dep))
If position > 0 Then
symbol_dep = Mid(Cells(counter + 3, 4), position, 2)
Cells(counter + 3, 10).Value = symbol_dep
End If
Next counter_dep
Next counter
It works, however, once in the first column there are the following objects: 60,6128,CZ, it takes 61 but it should take 60. Unfortunately, the position of the object can vary, it is not always on the first position.
View 9 Replies
View Related
Dec 10, 2009
I have code that retrieves the body of an email. I need to parse out certain parts of the text. For example, the text will look like the following;
LastName: John Doe
Email: johndoe@aol.com
Cell#: 555-555-5555
FileRequested: xxxxx.xlsx
I have the code to find where the specific item, ie LastName, starts in the whole text. I need to retrieve everything to the right of the : before the CRLF. That's what Im having trouble with.
View 9 Replies
View Related
Jun 29, 2007
I have at database which i want to search in... The problem is that i wanted to search in specific cells, or ranges. So i made a for loop searching for words in one range.. But it doesn't work.
For i = 0 To antal - 1 Step 1
Worksheets("Søg").Select
If Range("B5") = "X" Then
Sheets("Database").Select
c = InStr(1, Range("B" & 2 + anRow * i), sgbygsag, 1)
Sheets("Søg").Select
Range("A1") = c
End If
Next
anRow is the delimiter between to databases. And sgbygsag is the string i am searching for, i have made sure that this really is a string. No matter what I do this code sets Range("A1") to "0".
View 9 Replies
View Related
Apr 30, 2009
I need to lock consecutive rows together before sorting. e.g. A1 contains a name and A2 is blank: B1 contains data related to name in A1 - so does B2, and so on. Therefore need to lock rows 1 and 2 together, then 3 and 4 together and so on, but sorting on the data in the first cell of the group e.g. A1
View 3 Replies
View Related
Jan 22, 2014
I've attached the spreadsheet I want to use. As you can see there are three sets of "bootcamper name" and "time" columns
I wanted to know how I can sort by name or time if I were fill in data that started from A7 and B7 all the way down to A43 and B43 then restarts at C7 and D7 all the way down to let's sat C30 and D30
If I wanted to list all the data alphabetically ( or by time ) from A7 and B7 all the way down to C30 and D30, how can I do that?
Terrible Tuesday.xlsx‎
View 5 Replies
View Related
Jul 31, 2014
I want to be able to download bank transactions in a csv file and have excel sort them according to rules I could define.
The csv file is organized as one transaction per row, with each row having several columns, one of which is a description that typically indicates the merchant.
I want excel to recognize a given merchant in the description cell, and then sort the associated row to be placed into a subcategory (linked to the given merchant) and then summed up.
For example,
a transaction with the description "Joe's Diner" would be sorted to Restaurants subcat
a transaction with the description "Dave's Supermarket" would be sorted to Groceries subcat
a transaction with an unrecognized description would be sorted to Misc subcat
View 2 Replies
View Related
Feb 27, 2014
Here is my code.
Currently I get a 1004 error. "Method of Range of Object _Global Failed" on "Range(Selection).Sort.SortFields.Clear"
Code:
Sub sortBacklog()
Dim appExcel As Excel.Application
Dim myWorkbook As Excel.Workbook
Dim myWorkSheet As Worksheet
Set appExcel = CreateObject("Excel.Application")
Set myWorkbook = appExcel.Workbooks.Open("C:Backlog.xls")
Set myWorkSheet = myWorkbook.Sheets(1)
[code]....
View 1 Replies
View Related
Jan 14, 2009
I have some data that is 300 rows x 43 columns.
I'd like to sort the 43 colums by using some of the rows. Is this possible using normal excel?
Alternatively is there a simple way to sort the colums in VBA?
View 9 Replies
View Related
May 18, 2009
I have data being fed from an application where it's difficult to sort the rows into ascending order. So is there a way that VBA can sort them and produce a value according to the order?
For example, Column A contains 5 rows.
Row 1's value is 4
Row 2's value is 1
Row 3's value is 2
Row 4's value is 3
Row 5's value is 5
If I were to sort these into ascending order, I'd get 1, 2, 3, 4, 5 in Column A. But I can't sort the rows so I need code to tell me which is the lowest number (1), which is the second lowest number (2), etc.
The purpose of the code will be to put values in Column B according to what's found in Column A. For the the lowest number, 1, the value in the cell next to it in Column B would be "a". For number 2, it would be "b", etc.
View 9 Replies
View Related
Apr 3, 2013
I'm trying to copy entire row from sheet "source" to sheet "output".
Condition: If cell or cells in range (E7: lastcoll, lastrow) value is "A" then copy entire row.
Find the excel template in attachment.
My problem is that my macro is copying particular row, as many times as many "A" finds.
I want to copy entire row just once doesn't matter how many cells with "A" are in particular row.
VB:
'function to find last column a change letter of column to number
Private Function ColLetter(LastCol)
ColLetter = Split(Cells(1, LastCol).Address, "$")(1)
End Function
[Code] .....
copyROW.xlsm
View 3 Replies
View Related