Sort Columns - First A / Then B / Then C

Oct 29, 2012

I'm having a bit of trouble creating a macro that will sort columns in order - I've created a form that allows people to select a broad category ie) Schools, then a sub category ie) Primary or Secondary, and type in a third ie) Projects or Teachers

I'm trying to write a macro so that once they enter the form, their choices will be automatically sorted alphabetically, first by column A, then B, then C - to look like:

Schools - Primary - Projects - A
Schools - Primary - Projects - B
Schools - Primary - Projects - C
Schools - Primary - Teachers - B
Schools - Secondary - Projects - C
Schools - Secondary - Teachers - A
Schools - Secondary - Teachers - B
Schools - Secondary - Teachers - C

However I'm having the issue where if column B or C are left blank - the columns are not sorted properly, and the categories in column A get separated out..?

My code at the moment looks like:

Range("A1").Select
ActiveSheet.Unprotect
Range("A1").Sort Key1:=Range("A2:A3"), Order1:=xlAscending, Header:= _
xlYes, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal

[Code] .......

View 1 Replies


ADVERTISEMENT

Move And Sort With One Column But Insert Extra Columns As Needed For Proper Sort?

Jan 13, 2014

Using DataEntry sheet for data.
Trying to rearrange the data to DataFormatedProperly sheet.
So far all I can accomplish is DataFormatedWrong sheet.

Edit: Not sure what happened but file was NOT understandable before. It should be correct now.

View 2 Replies View Related

Sort Horizontally. Sort Across Columns

Dec 30, 2006

I am trying to sort a long range of text that is placed horizontally in a spreadsheet. I can do it vertically with the sort function in Excel but it does not seem to work for text that is placed horizontally. Example is as below:

Inventory Accounts Human Resources

View 2 Replies View Related

Sort Multiple Columns, With Blanks, And Move All Columns Into One

Feb 15, 2010

I found this code on Ozgrid to sort all columns of a worksheet that were continuous with no gaps or spaces that works well:

Sub CopyToA()
Do While ActiveCell <> ""
Range(ActiveCell, ActiveCell.End(xlDown)).Cut Destination:=Range("a65535").End(xlUp).Offset(1, 0)
ActiveCell.Offset(0, 1).Select
Loop
End Sub

However, I've tried to manipulate the code myself to 1) find all columns that aren't empty then 2) sort each column individually (WITHOUT expanding the sort to other columns) and 3) combining all the numbers into one seperate column. There are many posts concerning sorting but not one that addressed this particular situation.

View 2 Replies View Related

Getting 15 Columns In Spreadsheet To Sort On One Columns As It Alphabetizes

Jun 10, 2014

Have a spreadsheet with 15 columns. In one of the columns is the name of the company and that column is not in alphabetical order. The city, state, zip code, business type and all the other pertinent data about that company is in the same row as the name of the company. My intent would be to put the company names in alphabetical order and keep all the company information in the same row as the company name.

View 1 Replies View Related

How Do You Sort Columns So That They Match Up With Other Columns With Like Data

Jul 2, 2008

I have two columns one is web addresses and the other is email addresses but the rows do not line up. I was hoping that since the second half of the email address matches the web address I could somehow sort them so that the email address column and web address column match up. Here is an example but keep in mind that this list is about 9k long and this is just a sampling so you may not see any in this example that match. Also I may have more than one email address per website.

View 9 Replies View Related

(Match & Sort) Sort Columns B And C So That A And B Match Up Numerically

Feb 26, 2009

I would like to sort columns B and C (keeping the two lined up together) so that A and B match up numerically.

View 3 Replies View Related

Auto-Merge Dates In 3 Columns And Then Auto-sort Merged Columns

Jan 10, 2012

I have dates values in 3 columns.

A1 - Header - "Holidays in XXXX'
B1 - Header - "Holidays in YYYY'
C1 - Header - "Leaves by YOU"

A2:B11 have static dates consisting of 10 dates in each column.
C2:C11 - the user may enter any date at any point of time.

I would like to auto-merge the dates in all the 3 columns (A2:C11) in a single column say D2:D31 and then the system should auto-sort the column based on dates in any one order. So as soon as the user enters a value in say cell C2, all the 10+10+1 dates should get sorted.

Also the constraint here is a user may not apply all 10 leaves at in a year. So many of the cells may have blank values.

View 1 Replies View Related

Sort All Columns Except For Few

May 3, 2009

I am using a formula but when it sorts with the data in the adjacent cells it does not update the reference cells properly.

For example here is the =SUMPRODUCT(($F$12:$WWX$12>=C1)*1,($F$12:$WWX$12<=E1)*1,ABS($F$13:$ZZ$13))

This code is located on row 13, when I do a sort function with all the data, this code is then moved to row 30, that is fine but the code changes in the following way:

=SUMPRODUCT(($F$12:$WWX$12>=C18)*1,($F$12:$WWX$12<=E18)*1,ABS($F$13:$ZZ$13))

C1 & E1 should not have changed at all, F13 & ZZ13 should have changed to F30 & ZZ30.

I am not sure if there is a way to fix the formula so it updates correctly, or these cells can stay in the same place as long as everything else sorts.

Is is possible to sort all columns except a few?

View 6 Replies View Related

Sort Columns A B C D And E

Jul 8, 2009

I am trying to get columns A:E on Sheet1 converted into columns A:H on Sheet2. I attached the workbook with the macro so you can see what I am talking about. I posted the same macro in the workbook below. It comes close to what I am trying to do but it only sorts based on Column E. I would like to include Columns A, B, C, and D in the sort instead of just Column E so the display will look like Sheet2.

View 2 Replies View Related

VBA: Sort On Two Columns

Oct 22, 2008

I have the necessity to execute a macro for sorting a list of data on two columns.
More exactly, let's suppose to have this situation:

A 10/2/2008 FFFF GGGG HHH
B 01/3/2008 PPPP LLLLL NNNN
B 12/4/2008 XXXX JJJJJ PPPP
B 08/1/2008 HHHH SSSS IIIII
C 15/10/2008 AAA BBBB CCC

I need this sort:
A 10/2/2008 FFFF GGGG HHH
B 08/1/2008 HHHH SSSS IIIII
B 01/3/2008 PPPP LLLLL NNNN
B 12/4/2008 XXXX JJJJJ PPPP
C 15/10/2008 AAA BBBB CCC

View 9 Replies View Related

Sort A To G And S Columns

Jun 26, 2006

r = Range("c65536").End(xlUp).Row
Range("a5:G" & r).Select

Selection.Sort Key1:=Range("G5"), Order1:=xlAscending, Key2:=Range("F5") _
, Order2:=xlAscending, Key3:=Range("C5"), Order3:=xlAscending, Header:= _
xlNo, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal, DataOption2:=xlSortNormal, DataOption3:= _
xlSortNormal
Rows("4:" & r).Select
For i = 5 To r
Rows(i).Select
If i Mod 2 = 0 Then
Selection.Interior.ColorIndex = xlNone
Else
Selection.Interior.ColorIndex = 36
End If
Next
Range("j5").Select
Application.Calculation = xlCalculationAutomat

this sorts range from A to G and set color to each second row how can I include S column in this range
I mean that cells in column S are moved with cells from columns A to G.

View 9 Replies View Related

Sort 4 Columns By Comparing 2

Aug 8, 2014

I have column A which contains a range of part numbers, and column B is an On Hand quantity of that part number.

Column C is just like column A, in that it contains the same part numbers but it has about 1,000 additional part numbers that are obsolete. Column D has the On Hand quantity for Column C.

Column A and B are old information as far as the On Hand quantities, where Column C and D are up to date On Hand. The problem is the old outdated part numbers in column C.

How do I make column A and column C match, but not lose their respective On Hand quantities? I know this sounds discombobulated, but basically I need column A's part numbers, with column D's on hand quantity.

View 2 Replies View Related

2 Columns Table Without Using SORT

Mar 1, 2009

I have some table with 3 columns: Name, Team, Players with the same name

I want to get to a 2 columns table without using "SORT" or something like that... using only formulas.

Maybe I wasn't so clear so I added a file with my problem.

View 11 Replies View Related

Sort Like Numbers In 2 Different Columns

May 4, 2009

I have 3 columns; A:Name, B:Debit & C:Credit. There are multiple row (approx 15,000) where I have a customer name and then a debit at one date, and a credit at another date. There is a debit to match every credit.

I would like to some how sort the sheet so that I can make sure each credit matched the debit. That way I can find what debit's don't match the credits. This is an example of how this looks. http://i303.photobucket.com/albums/n...kejoe/sort.jpg. I would like to sort it like the example on the far right (see attached picture)

View 3 Replies View Related

Match And Sort By Two Columns

Feb 4, 2010

Column A has customer name, columns B,C,D has corresponding sales data for
that month. Column E is blank. Column F has has customer name. Column
G,H,I has the same corresponding sales data for the next month.

Although Column A and F both have customer names, there are many changes
month over month with the addition and deletion of certain customers so the
rows do not match up exactly. Is there a quick way to have the rows match up
according to customer names in column A and F and then sort them
alpabetically?

Currently my list looks like this:
Jan Feb
A A
B C
D D
F E
H F
L G
M H

I would like it to look like this:
Jan Feb
A A
B
C
D D
E
F F
G
H H
L
M

View 14 Replies View Related

How To Sort Two LARGE Columns

Oct 11, 2013

I have a list of domains (about 200,000) that looks like this:

I have a list of urls (about 1 million) that looks like this:

I want my results to only show this (since this is the only thing in the second file that does not contain anything from the first file):

I have tried programs designed to do this but they either (a) shorten everything down to the domain or (b) wont remove anything since the domains are part of a longer url in the second file.

View 3 Replies View Related

Sort / Shuffle Certain Columns For Given Row

Mar 2, 2014

I feel like this should be somewhat simple, but none of the normal methods I know seem to work. I want to set up a formula (not a basic sort, since I want it to automatically correct every time I change information) so that for each row, several columns re-sort by date.

For instance, I have the following table:

Item Type Dates

A DV 5/2/14 6/12/14 7/11/15
B DS 3/11/13 6/19/14 1/2/15
C LG 11/12/14 8/1/15 1/12/16
...

where each of the dates is in a new column, but the "Dates" title is merged between the cells

I want to be able to resort just the date columns(/cells) for each row if a new date is written. I want the dates to be in ascending order. For instance, if I go back into the worksheet and replace Item A's date 5/2/14 with 1/1/16, I want the date columns JUST FOR Item A to reshuffle/resort to be:

A DV 6/12/14 7/11/15 1/1/16

without it resorting any other rows (Items) columns.

View 5 Replies View Related

Macro / VBA To Use 2 Columns In 1 Sort

May 13, 2013

I am trying to write a Macro to basically do a lot of redundant formatting for me and I am stuck on one part of this code. Everything else works just dandy, but I am having the darndest time getting this Macro to sort by 2 columns instead of just 1.

I did the basic first step and recorded myself sorting the datasheet by both columns in 1 sort and got the code, but the problem is that the number of rows will change day-to-day, week-to-week, and so on, so I need it to not specify a cell number as the end of the range.

While searching around, I saw a very handy little piece of VBA code that will search for a header name, which is really nice because that would make it much easier to share this Macro with my coworkers who have different reports that all have columns in different locations.

So, I have a multi-part question. I will start with the most important one:

How do I alter this to not specify A9590 and D9590 as the last cells in those ranges?

ActiveWorkbook.Worksheets("Date XREF").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Date XREF").Sort.SortFields.Add Key:=Range( _
"A6:A9590"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortNormal
ActiveWorkbook.Worksheets("Date XREF").Sort.SortFields.Add Key:=Range( _
"D6:D9590"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortNormal

[code]....

Is there a way to have the Macro find where the header row is? The header rows in our reports can appear anywhere from Row 1 to Row 8 depending on how the report is set up (usually we have some information about the data, date range, etc at the top).

Dim c As Integer
With ActiveWorkbook.Worksheets("Date XREF").Range("A5").CurrentRegion
c = .Find(What:="Assignment ID", After:=.Cells(1, 1), LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False).Column
.Sort Key1:=.Cells(1, c), Order1:=xlDescending, Header:=xlYes, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
End With

View 2 Replies View Related

Macro To Sort Three Columns Into One

Jun 25, 2013

I have a sheet that looks like this...

Date
Start #
End #

1/1/11
1000
1099

[Code] ........

And I want to sort it to look like the following, in order to track each number to a date and to enter into an external database...

Date
#

1/1/11
1000

1/1/11
1001

1/1/11
1002

I need to list the entire thing instead of having starting and ending part #s. Any macro to do this? The actual spreadsheet has 250 dates and over 30k part #'s so doing it out is not really an option.

View 9 Replies View Related

Sort Columns By A Button

Apr 6, 2007

I have a code with perfectly sorts Excel rows when you click a button:

Private Sub CommandButton1_Click()
Worksheets("Sheet1").Range("C1:S70").Select
Selection.Sort Key1:=ActiveCell, Order1:=xlAscending
End Sub
but if i like to sort the columns by Row 1 how i can do it?

View 9 Replies View Related

To Sort The Objects In Columns A, B, & C

Apr 23, 2007

Here is the Sheet so far: ...

View 9 Replies View Related

Sort Text To Certain Columns

May 30, 2008

What formula will sort the infomation in the first column into the other relevant columns.

View 9 Replies View Related

Sort Two Columns Simultaneously

Apr 8, 2009

I'm trying to sort selected rows by two columns, but simultaneously instead of sorting by "Column A and THEN Column B". In my case, this is numerical data where there is ONLY data in one column or the other, never both.

For example:
5 _
10 _
_ 1
_ 6
_ 4

Should sort to:
_ 1
_ 4
5 _
_ 6
10 _

View 9 Replies View Related

Sort Across Columns Left-To-Right

Apr 7, 2008

Is it possible to re-order entire columns based on cell values? For example, row A gives values of 1 thru 10 to the first 10 colums. I would like a macro that reorders the entire columns based on that value.

View 6 Replies View Related

Auto-Sort Columns

Jun 29, 2008

I am trying to create a VBA macro that autosorts a selection of columns by column A. I currently have the below already written which gives the desired effect. I was just wondering if there was a way i could have this script constantly running on the sheet so it is always sorted correctly without me having to click Run Macro everytime.

Sub Macro1()
Columns("A:F").Select
Selection.Sort Key1:= Range("A1"), Order1:=xlDescending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
End Sub

View 2 Replies View Related

Match And Sort Data In 6 Columns?

Jan 6, 2014

Column A has donor name, column B has corresponding donation data for 2011. Column C has donor name, and column D has donation data for 2012. Column E has donor name, and column F has corresponding donation data for 2013.

Although Columns A and C and E all have donor names, there are many changes
from year to year with the addition and deletion of certain donors so the rows do not match up exactly. Is there a quick way to have the rows match up according to donor names in column each of the three columns? Secondarily, I need to sort by donation amount from highest to lowest (it can either be the total over the three years or based on any single year.

Currently my list looks like this:
2011 2012 2013
A A A
B C B
D D C
F E D
H F I
L G K
M H M

I would like it to look like this:
2011 2012 2013
A A A
B - B
C C -
- D-
- E-
F F F
G G G
H - -
L - L
- - M

Basically, I want to see the year over year giving for each donor. I've attached a sample for refrence. (I can't post the original due to confidentiality requirements.)

View 2 Replies View Related

Sort Data Over Multiple Columns

Nov 6, 2009

I'm trying to figure out a way ( excel 2000) how to sort data over a range of columns.

Attached is a sheet.

So what I am looking for is this:

Bottom 10 for target 1, target 2, target 3.

I can sort them indervidually, but is there a way to sort the all?

Or would I need a agent column for each target to sort?

Or maybe there is a way to sort the data so it would work out that if they are in the bottom 10 of lets say 2 of the targets but not all 3 they would still show in the bottom 10?

View 7 Replies View Related

Merge And Sort Data Across Columns?

Dec 19, 2012

So I have several columns of data that have a location and then some numbers after it in additional columns. I need to be able to sort it so that all locations that are in both location columns are sorted first, and then any locations that are in one column but not the other column follows. Also the data associated with each column that follows the location needs to remain next to the location. Many times the columns will be of highly disportionate lengths too.

I've attached an HTML table so you can get an idea of what I am looking at, except what I'm dealing with is like.... hundreds of cells long.

I want to be able to turn this:

HTML Code: 

<table border="1" bordercolor="#FFCC00" style="background-color:#FFFFCC" width="100%" cellpadding="3" cellspacing="3">
<tr>
<td>A</td>

[Code].....

And in this 6 row example, I'd actually only be interested in the 4 letters that were in both columns. If it makes it easier, I would be okay with discarding the last rows, but would rather just have them sorted at the end, so I could check if....for example there were two different spellings of the same thing, and they should actually be included.

View 3 Replies View Related

Any Way To Sort Two Columns As One Virtual Column?

Mar 7, 2014

When I press SORT A-Z (through a column filter) on my spreadsheet, I want something like this to happen. Is it possible?

EXCEL.jpg

View 4 Replies View Related







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