Use VBA To Sort Data In Particular Order
May 9, 2014
I have a list of data with headings number,name, surname,group. Data needs to be kept in the rows as they are now but I would like to sort the order by group. The group order needs to be:
sm, u17m, u15b, u13b, u11b, sw, u17w, u15g, u13g, u11g. I would like to do this using vba and have a blank row between each group.
View 11 Replies
ADVERTISEMENT
Dec 17, 2013
I have imported data and numbers from a website and would like to sort the data in numerical order. Excel wants to sort the data 1,10,2,20... in that order. I know from past experience with an older version there was a way to convert the numbers so they can be sorted in the way that I want.
View 2 Replies
View Related
Sep 1, 2009
I am trying to sort a column of data in ascending order but I am not getting the results I expect. An example of the data held in the cells is:
4972-1A
4972-10A
4972-2A
4972-1B
4972-3C
When I sort it in ascending order it sorts like:
4972-10A
4972-1A
4972-1B
4972-2A
4972-3C......................
View 4 Replies
View Related
Apr 8, 2012
Im am looking for a way of automatically sorting the data I have in column "C" (C2:C99 to be exact).
The data represents stock codes which are a mix of text and numbers, starting with 1 letter followed by numbers.
I would prefer something I can put in the sheet tab view code section, so that when any new data is added or altered it automatically sorts the stock codes in to alphabetical then numerical order
EG:
A10
A11
B13
B15
etc....
View 3 Replies
View Related
Feb 1, 2008
I will need to sort the data based on some number entries being presented in Periods 1 ,2 ,3 in chronological order.. i.e. move the data of period 1 to the top , then period 2 and then period 3.
View 5 Replies
View Related
Apr 11, 2008
Need code for automaticcally sort data in ascending order any time there was a change in score. The names column is b1:43 and the corresponding score would be in column c1:43. I can't seem to do it.
View 9 Replies
View Related
May 23, 2012
Excel 2007.
The first part of this code is fine and completes all the borders.
The second part is to the all the workbook by Data Sort in ascending order starting with
Column C
Then Q
Then column V
But also knowing to search to the last line. I think i might be close but not close enough for this to work.
Sub Macro2()
Dim LR As Long, i As Integer
Dim mysheet As Worksheet
Sheets("Test").Select
LR = Range("A" & Rows.Count).End(xlUp).Row
With Range("A9:AD" & LR)
[Code] .......
View 2 Replies
View Related
Oct 8, 2006
Is it possible to make excel sort ascending or descending but from mid way through alphabet and then loop through the alphabet again. for example. If Cell A1 had "A" in, it would sort as normal.
Cell A1 = A
Cell A2 = B
Cell A3 = C
Cell A4 = D
Cell A5 = E
If Cell A1 had "C" in, it would sort from "C" through the alphabet and then loop to the start of the alphabet as shown below.
Cell A1 = C
Cell A2 = D
Cell A3 = E
Cell A4 = A
Cell A5 = B
View 4 Replies
View Related
Aug 2, 2007
i have A1:A60 filled with numbers. however, they are ordered incorrectly. how can i order then in B1:B60 in the following way?
1st cell
7th cell
13th cell
19th cell
25th cell
31st cell
37th cell
43rd cell
49th cell
55th cell
2nd cell
8th cell
14th cell
20th cell
26th cell
32nd cell
44th cell
50th cell
56th cell
etc.
until the 60th cell
View 9 Replies
View Related
Feb 10, 2009
I need values from column F in ascending order.
Also I need in column G only the values without formula.
View 14 Replies
View Related
Nov 20, 2007
I'm sure this has been asked many times before, but I can't seem to find an answer that works for my data. I have some data that is sorted by an ordered list (like a table of contents from an overly detailed book):
1.0
1.1
1.2
1.2.1
1.3
...
1.11
...
This list can be arbitrarily deep (although probably not more than ##.##.##.##), and because I'm using periods to separate the nested levels (can be changed), I've formatted it as text. This means when I sort the data using this column I get 1.11 before 1.2 (text sort order).
After lots of failed formula attempts I've resorted to using an additional column with hand-entered values to sort by so it will sort correctly:
1.00.00
1.01.00
1.02.00
1.02.01
etc
but I'm hoping someone knows a more elegant way to do this, or at least to generate this column without typing so many zeroes!
View 9 Replies
View Related
May 30, 2008
I have a client with a list of books, and they are trying to sort a column in a sheet that has LC classification codes. When just doing a normal A-Z sort, it looks like this:
RJ 41 .D53 F54 2005
RJ 416 .L4 C52 1999
RJ 420 .D5T97 2003
RJ 421 .H385 2006
RJ 426 .H43 P43 2005
RJ 431 .M37 2003
RJ 436 .A8 R33 2006
RJ 436 .A8 T498 2001
RJ 436 .A8 T87 2003
RJ 45 .N4 2000
RJ 45 .N418 2006
RJ 45 .R92 1998
RJ 47 .E39 2001
RJ 48 .H37 2000
RJ 48 .H37 2002
RJ 48.2 .C537 2004
RJ 48.2 .P347 2005
RJ 48.2 .P385 2005
RJ 48.2 .R93 2003
RJ 480 .P34 2005
RJ 482 .R48 L448 2004
RJ 486 .C45 2000
What is weird about it is that I would think that the numbers after the RJ would be in numeric order but it seems to be treating them as codes. So, instead of RJ 41, then RJ 45, it goes on with a series of things that start with RJ 41. Is it normal for this to happen, or is there a way to change it so that it goes 41, 45, 47, 48, then 416, 420, etc.
View 9 Replies
View Related
Feb 13, 2007
I feel I've searched thoroughly and wasn't able to find the right answer. I've attached a daily report example that needs the "Product" field to be sorted in a particular order. The order should be JEX, Q3791J, YOO5, KLX9, GHT (all similar products need to be grouped together).
Since the report is run daily the number of rows changes daily: one day can have 50 entries and the next 10. Is there a way to dictate the sort order and insert a blank row between each product grouping?
Once the Products have been separated into their groups, how would I sort each grouping by the "Term" column?
View 9 Replies
View Related
Jun 14, 2014
I have 2 listbox (List1 and List2). List2 get populated when the user select a value in List1 and based on the value selected in List1. My issues are:
1- Values in list2 are not sorted in ascending order especially when the list2 grows over 32.
2- When the user selects "None" in List1, it should clear List2 (onclick)
I worked on this code for a while with no luck trying to get it to work. Is that doable?
VB:
Option Explicit
Dim ufEventsDisabled As Boolean
Function SelectedString() As String
Const Delimiter As String = ","
Dim i As Long
[Code] .....
View 9 Replies
View Related
Mar 15, 2014
Don't know if macro is better, but I would like to try it with function
I have 2 sheets.
Sheet 1
Column A: Name
Column B: Points
Exemple:
Name Points
Mary 40
Johnny 20
Erick 60
Ralph 30
I want Sheet 2 to get data from Sheet 1 and sort by descending order automatically.
Then it should be
Sheet 2
Name Points
Erick 60
Mary 40
Ralph 30
Johnny 20
I don't want to do it manually every time I change some value; I want it to do automatically; so if I change, for example, Erick's points from 60 to 10 in Sheet 1, Erick should appear on the last place in Sheet 2, with his new value (10)
View 1 Replies
View Related
Feb 20, 2009
I have a spreadsheet for work that consists of various columns of data. One important sorting column would be Job #. Inside this coulumn are data like 134-Q and 2355-P and 755-P for example. The sort now is like posted. I would like to be able to sort by both alphabetical and numerical order. ie, 755-P, 2355-P, then 134-Q.
View 5 Replies
View Related
May 1, 2013
My dates are sorting as per the image below.How do I get them to sort in chronological order (e.g. 01 January, 02 January etc)
Excel Forum.PNG
View 10 Replies
View Related
Nov 5, 2008
Im totally new to excel and have some data i need to sort. how to sort numbers into ascending order across a row. ie, I have 34 2 45 79 102 63 etc, and I need them to start low and order to high. i have over 1200 rows, so it would be good to do the whole sheet at the same time.
View 4 Replies
View Related
Oct 19, 2009
I have to sort data on 3 criteria
The data is:....
At this time I sort by HOURS then Seniority so the sort would look like this:........
Here is the problem, RN HILLER and JA DOE have the same hours and seniority. It is our policy that when 2 or more names and seniority match, they must be sorted by reverse order first letter of last name.
So this would be correct. H in Hiller comes before D in doe when reverse sorting.....
View 4 Replies
View Related
Oct 7, 2011
I have the below code that sorts a list of Doors that I have in row C17 downwards. Door 54, Door 7, Door 109 etc. The list is feeding a drop down box, people find the door they were looking for, in the said drop down box.
Code:
Sub ListSorter()
Dim LastRow As Long
LastRow = Range("C" & Rows.Count).End(xlUp).row
[Code]....
I wondered if there was some code I could add to the end of this, that would the sort worksheets, which are all named after each cell in the list, in the same order.
View 3 Replies
View Related
Sep 25, 2012
In the below code, when I want to sort on Column "A" it is not working. Anything stand out that would prevent my code from working?
Sub Delete_Duplicates()Dim LastRow As LongWith Sheets("SAP Raw Extract")
LastRow = .Cells(Rows.Count, "A").End(xlUp).Row 'Create ID Column
.Columns("A:A").Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove .Range("A1") = "ID"
.Range("A2").FormulaR1C1 = "=RC[5]&RC[6]&RC[32]"
[Code] .....
View 3 Replies
View Related
Jun 17, 2009
I'm using a table with columns from A to F and an unlimited number of rows. Note that there is a title at the top of each column.
-I'd like my datas in column F to be automatically sorted in descending order from top to bottom when I hit the enter key or when the number is entered in last column (column F).
-the the entire row of data needs to be sorted according to the sorting criteria of column F ( datas entered need to stay on the same row)
-the macro should validate that the number value entered in column F is the same as the number value entered in column A. (to make sure that there was no typing mistake)
-Result in column D must be the difference between the corresponding value in column B and C (B-C=D)
*The next couple of constraints are not absolutely required, i'd like to have them only if it's possible to add constraints with filling color:
-Whenever there is no value entered in column C on a specific row I'd like the entire row to be colored in yellow (fill color)
-IF a number is entered in column C, and that the result of B-C in column D is not equal to zero, I'd like this specific row to be filled in Red.
-when all the values are entered in a row from column A to F and that the result of B minus C is equal to Zero in column D, i'd like this specific row to be filled in a green color.
***in other words, the datas in each rows from column A to F will be entered on 2 occasions; on the first time, only the datas in column A,B and F will be entered (so basically after entering this set of values the row should be filled in yellow. the second time, the remaining values will be added to the rows, so at this time A,B,C,D,E and F will all be entered. when this is done there will be two options
1-the value in column D is equal to Zero then the entire row should be filled in green or
2-the value in column D is'nt equal to zero, then this specific row should be filled in red.
Keep in mind that the datas of a row should be automatically sorted only when the value in column F is entered or when the enter key is hitted to add a new row.
View 9 Replies
View Related
May 13, 2009
I am trying to create custom sort list. It works below when I define range as A1:A79.
Sub SortWS2()
Dim SortOrder As Variant
Dim sheetsorder As Range
Dim Ndx As Long
Application. ScreenUpdating = False
With Worksheets("Sort Order").Range("A1:A79")
For Ndx = .Cells.Count To 1 Step -1
Worksheets(.Cells(Ndx).Value).Move before:=Worksheets(1)
Next Ndx
End With
Application.ScreenUpdating = True
End Sub
I have created a dynamic range called sheetsorder. If I revise my code it does not work.
Sub SortWS2()................
View 6 Replies
View Related
Aug 9, 2006
I have a worksheet populated with text and values from column A to BG, and from row1 to row550. Column B contains only the following text and values:
TKM SG
1
TKM Kulim
zero bin (internal)
0.33 bin (internal)
3
ESC
2
zero bin (AMA)
I need help for VBA code to sort the worksheet by this order of preference in col B as follow. Appreciate your help.
1
2
3
TKM SG
TKM Kulim
zero bin (AMA)
zero bin (internal)
0.33 bin (internal)
ESC
View 5 Replies
View Related
Feb 23, 2007
I am trying to do 2 things.
1) I want to make a drop down box with 3 differnent sort orders options in it.
- Sort by date
- Sort by Customer
- Sort by priority level
Once they select a view, it will then sort the rows to that view.
2) I want to do a filter box, so if I type a cutomers name, it will filter to only show the rows related ot that customer.
View 9 Replies
View Related
Apr 4, 2007
I am trying to sort a combo box by ascending order...this combo box displays 2 columns of data which are populated from a spreadsheet. I would like to sort by the first column in the combo box which is numeric, but I do not want to sort the actual data on the spreadsheet.
View 2 Replies
View Related
Oct 11, 2007
I am trying to sort worksheets in excel by numerical order. I have renamed each worksheet with a different zipcode that corresponds to data on that sheet.
I believe there might be two ways to do this,
1) by sorting numerically the worksheet names.
2) by perhaps referencing a cell on each worksheet (i.e. the zipcode) and sorting it that way.
View 7 Replies
View Related
May 14, 2008
I am trying to sort different SKU #'s for my amazon store on excel. I go to Data... Sort... Ascending and it comes out like this...
UP1
UP10
UP100
UP101
UP102
UP103
UP104
and so on...
i want it to be like this
UP1
UP2
UP3
UP4
UP5
View 3 Replies
View Related
May 23, 2008
I would like to sort my column A by "Urgent, High, Medium and Low". However, when I click on sort, it obviously sorts alphbetically. Need to code to sort all colums A:K.
View 5 Replies
View Related
Jun 21, 2014
in column A i have Customer's Names in column B Customer's Surnamas
Col:ACol:B
MikeConroy
JohnSmith
SimonConroy
DaveMont
BradOrton
BradOrton
MikaDavidson
MikaDavidson
ValeAndersone
KenjiIgawa
AsenAdkins
SimonConroy
i need to sort Customer's Names by alphabetic order without repeating in a line
AsenAdkins
BradOrton
DaveMont
JohnSmith
KenjiIgawa
MikaDavidson
Simon Conroy
ValeAndersone
BradOrton
MikaDavidson
Simon Conroy
MikeConroy
View 10 Replies
View Related