VBA To Custom Sort Data Based On Referenced List

Feb 17, 2014

Sort Example.xlsx

I have data in Sheet "Schedule" in range A8:C160 (including column headers), but note the length (rows) of the range is dynamic.

A8 = Customer
B8 = Load Time
C8 = Delivery Time

Columns B & C are formatted as h:mm:ss AM/PM, but Column B also includes text..."PRELOAD"

I would like a macro to sort the data based on column B, but the sort must follow a specific order, which is listed in Sheet "TimeSort", range A1:A50 (including header).

The custom order basically has "PRELOAD" sorting at the top, then sorting everything else chronologically starting at 6:00am.

The desired outcome would sort the range based on column B as follows...PRELOAD, 6:00:00 AM, 8:00:00 AM, 12:00:00 PM, 5:30:00 AM

Example is attached (desired sort is reflected).

View 14 Replies


ADVERTISEMENT

Custom Sort Data Based On List With More Than 255 Characters

Apr 21, 2014

How to sort a column of data based on a custom list with more than 255 characters.

I have created a named range with 40 entries and then added data validation in the cells of column D using the above named range. However, I want to be able to sort column D in the same order as the named range but the custom data sort lists are restricted to 255 characters.

View 1 Replies View Related

Custom List To Sort Data

May 28, 2014

I am having trouble finding info on this. I am trying to create a custom list to sort data.

I only want to sort two of the letters in my first Level or Column. For instance I want to sort Column A Alphabeticaly as A, B, C, D, but once I get to E, have the rest of the list in a random order that is sorted by my next level. Is there a wildcard character that can be used to have my next sorting level take over once I get to E?

View 4 Replies View Related

Add Custom Sort List To VBA Code

Mar 12, 2009

I have a Macro that I have recorded that autosorts several columns for me. This works fine as I have 5 columns that need to be sorted in a particular way.

The problem is that I have a custom list which I stored using the: Tools>Options>Custom List tab. Now this works fine on my pc as I have the custom list stored on my PC.however the problem is when someone else uses it on their PC it may no longer work as they won't have my custom list stored on their PCs.

Is there a way to store the custom list in a Macro and then use that list to sort to the criteria needed. For example "One, Two, Three, Four" will not store in alphabetically, so hope would I be able to sort so that they would appear in a chronological manner? Below is the code for the Macro I recorded. As you can see one of the lines says "OrderCustom:=6"; this I am assuming is reading from the list I created.

View 2 Replies View Related

Using Custom Sort List Within Macro

Aug 3, 2009

I have following code, which sorts data if user "double clicks" on cells A1, B1, C1, or D1. If the user "double clicks" on cell D1, I want to sort by column D but I want to apply a custom list. The data is in the "Custom Lists" table but I can't figure out how to apply to my code.

The sequence/sort order of the list is as follows:
aaa+, aaa, aaa-, aa+, aa, aa-, a+, a, a-, bbb+, bbb, bbb-, bb+, bb, bb-, b+, b, b-, ccc+, ccc, ccc-, cc+, cc, cc-, c+, c, c-, ddd+, ddd, ddd-, dd+, dd, dd-, d+, d, d-
code is as follows:

View 3 Replies View Related

How To Create Custom Sort List

Aug 25, 2013

I am trying to create a custom sort list by going to preferences/custom lists and typing 37 items into a new list in Excel. It will not take all of the items after I type them in. Is there a limit as to how many items can be in the list. It seems to only take 18-20 items out of the 37 and erases the rest.

View 9 Replies View Related

A Custom Sort List Longer Than 255 Characters?

Apr 30, 2009

I have a large list of parcels to be delivered which have names, the last 2 letters of the postcodes, addresses tel. no. etc. I have created a custom sort list of postcodes in the order I want to deliver them. I can only list a total of 85 postcodes since there are 2 characters in each postcode and a return at the end of each line, hence 85*3=255.

Is there any way I can make excel sort my list of parcels using a spreadsheet list of the 2 postcode letters of unlimited length? There is a theoretical maximum of 676 postcodes in my area (26*26) so I would need it to be at least this long. It would also be more convenient if it were an excel based list since the editing of such a list would be more convenient.

View 3 Replies View Related

Auto Custom Sort List On Certain Days

Jan 23, 2009

I have a fairly large watch collection as below which I wear on a daily rotating basis(!).

FORTIS
Seiko
OMEGA SPEEDMASTER
Seiko
SINN 144
Seiko
Accurist
Seiko
TEMPTION
Seiko
OMEGA TRIPLE DATE
Seiko
Junkers....................

View 9 Replies View Related

Generate List Of Data Based On Sort Data From Another Worksheet

Feb 25, 2014

I have Sheet1 "MASTER" and Sheet2 "Area1" and Sheet3 "Area2" etc...

My MASTER sheet has a list of employee names and the areas they work in. I have employees working in different areas, and I want to pull a list of employee names from the MASTER working in Area1 (sorted on the MASTER sheet) to column A on Sheet2, then pull a list of employee names working in Area2 to column A on Sheet3, etc...

I want it to do this in such a way that if I add an employee to Area1 on the MASTER data, it will populate that employee in the Area1 Sheet.

So basically, I'm looking at one column on the MASTER sheet to see if the area matches. Then looking at another column on the MASTER sheet to get the name. Then taking that name and transposing it to a new sheet corresponding to the area they work in.

I've attached a sample sheet. I want Column A in the Area1 sheet to reflect all names that show up on the Area1 LIST on the MASTER sheet, and nothing else. I'm using VLOOKUP to pull the rest of the data from the MASTER table.

There is a new sample workbook up now. Couldn't update it sooner due to site outage. I've removed irrelevant data to improve readability and focus on what I'm trying to achieve. Again, the main issue is scraping column E from the Master, and populating a list of all employees who match certain values in Column E on the Master in Column A of the other tabs.

View 2 Replies View Related

Sort Command - Custom Order Or Sort Ascending Or Descending

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

Sort Worksheets Using Custom Sort To Choose Certain Word?

May 30, 2012

As of right now these are the steps i do to sort...i click custom sort choose My data has headers and then i select from the drop down list the word FRNAME.

is there any way i can setup a macro to do this for me? i tried recording the macro but it just is recording me choosing the column FRNAME is in. This does not work for me since FRNAME end up being in different columns all the time but will always be in row 1.

View 1 Replies View Related

Macro To Autofill With Custom List Based On Value Of Current Cell

May 25, 2012

I have an Excel file for work that has the following:

Column 1 is Agent
Column 2 is Interval (in 15 minute intervals from a report that I pulled)
Column 3 is Agent Calls (has a number anywhere from 1 - the highest currently is 19, which tells me how many calls that Agent had on that 15 minute interval.)

What I have currently is that if it says:

John Doe 15:00 5

It will automatically insert rows after the number based on a # -1, so it will add 4 empty rows after this row.

I have another step that will automatically copy Column 1 and Column 2 to the blank rows directly beneath them until it reaches a cell with data.

Now, what I need is a macro that will take Column C and where it says 5 automatically know to change that to '5a' then proceed to go down the list with 5b, 5c, 5d, & 5e. If it sees 4 it will know to change that to '4a' then proceed to go down the list with 4b, 4c, & 4d. I currently have numbers ranging from 2 - 19.

I have built custom list with this information so if I change all the numbers from 4 to 4a or 19 to 19a and double click on the black box it will autofill exactly like I want but it only goes down to the next cell with data, and I have 100+ lines per agent, and up to 21 agents a day, so this gets time consuming.

Here's how it looks when I'm ready to start the macro:

JohnDoe - Doe, John15:00 x
JohnDoe - Doe, John15:15 4a
JohnDoe - Doe, John15:15
JohnDoe - Doe, John15:15
JohnDoe - Doe, John15:15
JohnDoe - Doe, John15:45 4a

[Code] ......

And I need it to look like this:

JohnDoe - Doe, John15:00 x
JohnDoe - Doe, John15:15 4a
JohnDoe - Doe, John15:15 4b
JohnDoe - Doe, John15:15 4c
JohnDoe - Doe, John15:15 4d

[Code] ........

View 7 Replies View Related

Sort Based On List

Jun 4, 2008

sorry for restarting this thread but i started one similar on saturday and the person I was talking to has not yet responded

I want to know if it is possible to adjust this code line:

Case "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"

from the macro below to instead get the case names from a list on a worksheet... the reason for this is that the names of the worksheets I want sorted will change periodically.

Sub SortDaysoftheWeek()
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
Select Case ws.Name
Case "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"
With ws
.Activate
.Range("A6:G256").Sort Key1:=Range("A6"), Order1:=xlAscending, Header:= _
xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
End With
End Select
Next ws
End Sub

View 9 Replies View Related

Sort List Based On Permutation

Dec 16, 2008

I'm new here, google helped me to find this place. Hope someone here can help me a bit on my excel spreadsheet. I have one list of numbers and it need to be sorted under Perm condition so the list become shorter. The function should go through the listed number and output new list after sorting it. I have attached my excel here.

View 7 Replies View Related

Custom Data Validation With Dropdown List

Jun 30, 2008

I have a data validation in a cell that works like this : if a control cell has the value "F" it validates the input with some dates in a custom list, if not it does nothing.

The formula looks like this :

=IF(F2="F",datelist,"")
It works fine but I also want it to display the drop down list when cell F2 = F, now all i can do is type a value and it checks if it's ok.
Can I do this without using vba ? I will send this to other persons and I don't want the macro warning to pop up when they open it.

View 9 Replies View Related

Dropdown Menu With List And Custom Data Validation?

May 2, 2014

I have a Drop-Down Menu that looks like:

BOS
PIT
COL
NYR

using List with source =Lists!$B$2:$B$9, which is just the validation list

My Table:
Team Player
BOS Bergeron
BOS Krejci
NYR Nash
... ...

My goal is to limit the end user from choosing BOS more than two times from the drop down menu

View 4 Replies View Related

List Of Data :: Unable To Sort

Nov 30, 2006

I am having trouble getting this list of data sorted the way that I would like.

Here is the data:

View 13 Replies View Related

How To Do Custom Sort In VBA

May 20, 2014

I am trying to sort a sheet based on the values in a column.

S, SI, M, MI. and it need to be sorted only in this order.

View 2 Replies View Related

Custom Sort Using VBA

Aug 18, 2006

I would like to custom sort a table by ID, the first ID to be shown on top would be the ID the user enters in an inputbox. Below is the code I used but I don’t know why its not working:

Sub CustSort()
Dim MyCount As Integer
MyCount = Application.CustomListCount + 1
MyValue = InputBox("Enter ID")
Application.AddCustomList Array(MyValue)
ActiveSheet.UsedRange.Sort _
Key1:= Range("A1"), _
Order1:=xlAscending, _
Header:=xlYes, _
OrderCustom:=MyCount, _
MatchCase:=False, _
Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Application.DeleteCustomList MyCount
End Sub

find attached an example, try entering 300000 in the inputbox the custom sort doesn’t work

View 6 Replies View Related

Custom Sort By 2 Fields

Sep 28, 2006

I'm wanting to be able to sort a table of data using a custom list for both the first criteria and the second criteria. I've setup my custom list correctly and it works perfectly for the first criteria, however, with the second criteria Excel just adopts its default sort order.

Is it possible to get it to use the custom list on the second criteria as well? Is there a simple VBA solution to this?

View 4 Replies View Related

Custom Sort Order

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

Return Results Based On Referenced Cell

Nov 21, 2006

I am looking at developing a table that has three possible options for different categories, being Yes, No and N/A. A yes score a certain percentage depending on what column it is, and the use of N/A changes the percentage of other scores. (i.e. A yes in column 5.1 = a score of 5, a yes in 5.2 = 5, a yes in 5.3 = 10 and a yes in 5.4 = 15. However if 5.4 is N/A then this amount is diveded amongst the remaining 3, i.e. 5.1 = 10, etc.)

View 3 Replies View Related

Using Two Custom Sort Lists In Macro.

Aug 4, 2009

This is somewhat related to a post I had submitted previously but a bit more complex http://www.excelforum.com/showthread.php?p=2139259. I have following code, which sorts data if user "double clicks" on cells A1, B1, C1, D1, or E1.

If the user "double clicks" on cell D1, I want to sort by column D using following custom list: AA1, AA2, AA3, A1, A2, A3, ZZ1, ZZ2, ZZ3, Z1, Z2, Z3. If the user "double clicks" on cell E1, I want to sort by column E using following custom list: AAA+, AAA, AAA-, AA+, AA, AA-, A+, A, A-, ZZZ+, ZZZ, ZZ+, ZZ-, Z+, Z, Z-

The issue I seem to be encountering is that I can’t use more than one custom list (e.g., if I use the column D sort list for column D, column E is also using the same list). I can’t seem to apply individual lists to each column. Would I need to “hardcode” the lists in my macro?

View 5 Replies View Related

Custom Sort Multiple Sheets?

Nov 23, 2011

I have found many macros for sorting multiple sheets by a single column in Excel, however, need macro for sorting multiple sheets by column "A", then column "B".

View 1 Replies View Related

Create A Custom Sort Order

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

Custom Sort Non-Contiguous Ranges

May 21, 2008

can anyone modify below macro to sort this data:

before sort:
---A-B-C--D-E-F--G-H-I
1-99-5-6-99-1-2-99-3-4
2-99-6-5-99-2-1-99-4-3
3-99-7-8-99-5-6-99-8-9
4-99-8-7-99-6-5-99-9-8
etc

after sort:
---A-B-C--D-E-F--G-H-I
1-99-5-6-99-1-2-99-3-4
2-99-5-6-99-1-2-99-3-4
3-99-7-8-99-5-6-99-8-9
4-99-7-8-99-5-6-99-8-9
etc

Sub SortNoncontiguousRanges()
Dim rRange As Range
Dim lArea As Long
'10 rows in columns B and C
'10 rows in columns E and F
'10 rows in columns H and I
Set rRange = Range("B1:C10,E1:F10,H1:I10")

With rRange
For lArea = 1 To .Areas.Count
With .Areas(lArea)
.Sort Key1:=.Cells(1, 1), _
Order1:=xlAscending, Header:=xlNo, Orientation:=xlLeftToRight
End With
Next lArea
End With
End Sub

View 9 Replies View Related

Sort By Specific Custom Order

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

Change Column Referenced In Formula Based On Date

Dec 12, 2013

I'm trying to create a list that references an existing data set where I have staff listed month by month and based on today's date, imports only if there is data in that column. I have figured out how to check if the cell is blank or not, but what I want to do now is change the cell that is referenced in the formula based on the date. Here is the format of the spreadsheet I'm working with:

A
B
C
D
E
F
G
H

[code].....

In this case, the "Team 1" and "Team 2" and "Team 3" references what team they are on that month. If it is blank, they aren't with the company any longer. The formula I am using is intended to import this data elsewhere, and is formatted like this:

=IF(ISBLANK(B2), "", A2) - My understanding is that this checks to see if B2 has data, and if it does, it inputs the employee name (A3) in that cell.

My ultimate goal is to be able to change the column referenced after the "isblank" calculation based on the date. So if today is April 2013, I want it to check B2, but if it's December 2013, I want the formula to check J2. Is there a way to do this? I don't mind if it's two steps (like if I have to put the date somewhere in the spreadsheet in order to run the calculation), but ultimately it would be the type of thing I could do that would leverage the existing data set so that I don't have to maintain two different spreadsheets of information.

View 2 Replies View Related

Excel 2010 :: How To Filter / Sort Data Based On Partial Match Of Data In Cell

Apr 16, 2013

I am using Excel 2010. I am a novice user.

I have a lot of data to filter / sort. I want to initially to create a filter for a column of data - which has the format similar to hierarchical paths to files. The data is a mix of text/numbers. e.g.

pathA/path_X/path_Y/path_Z/lso0_rxs_reg_254__5_0/d
pathA/path_X/path_Y/path_Z/lso0_rxs_reg_253__5_0/d
pathA/path_123/path_456/data_out_reg_17_0/d
pathA/path_123/path_456/data_out_reg_0_0/d
pathA/path_X/path_Y/path_Z/lso0_rxs_reg_255__5_0/d

[Code] .........

Doing an alphabetical sort of this date would return the following order. As you can see while each strings in unique - there are many instances where they are simialr - if you ignore the unique numeric values at the end of the string.

pathA/path_123/path_456/data_out_reg_0_0/d
pathA/path_123/path_456/data_out_reg_17_0/d
pathA/path_123/path_456/data_out_reg_4_0/d
pathA/path_X/path_Y/path_Z/lso0_rxs_reg_230__6_0/d

[Code] ......

So what I want to do is to create a filter for the strings - but ignoring the numeric bits at the end i.e.

reg_[0-9]+_+[0-9]+/d

The strings are obviiously of varying length and the number of hierarchical paths is different, so I can't split string on "/".

Similarly folder paths names can contain "_" so can't split string on this either.

As I don't know how many "/" or "-" instances there will be in the string I don't believe I can use the find function. Also as the amount of number will be different i don't think I can use =right(a1,X) either.

I may be able to search for the pattern above - as this is probabay unique - so maybe it's something like the following pseudo code:

Function GetString(txt As String) As String
With CreateObject("VBScript.RegExp")
.Pattern = "reg_d+(_)+d+//d"
GetString = .execute(txt)(0)
End With
End Function

If I do require VBA code - how do I then use this for creating a column filter? Or will I have to extract the filtered data first from the column (and its associated row data) into another worksheet to use?

Once I have the filter in place I want to create tables using the filtered data - so for example each column value above has a lot of associated data values in each row e.g

26 pathA/path_123/path_456/data_out_reg_0_0/d
32 pathA/path_123/path_456/data_out_reg_17_0/d
8 pathA/path_123/path_456/data_out_reg_4_0/d

So my table would show the name "data_out_reg" and the range of values 8-32

View 1 Replies View Related

Automatically Sort Data And Ranking Based On Sorted Data?

May 22, 2012

In the attached spreadsheet I track the performance of my team. I enter the AHT for my team in the work sheet named "AHT Summary".I keep updating this data every month. automatically sort the updated data and rank the agents based on their average AHT. The person with the lowest AHT should be ranked 1. Column is highlighed in green for your reference. Based on this ranking the work sheet named "Ranking" should be updated automatically. Since I am taking a weighted average for all agents, the one who gets the lowest AHT should be ranked 1st . In the ranking work sheet the agent with ranking 1 should be given 100, the second highest ranked person should get 98,third 96,fourth 94 etc.

View 6 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved