Sort Data With Two Header Rows
Apr 30, 2008
I have two header rows on a sheet that I need to sort starting on Row 3, Column A.
The sheet is A-K and rows 1 and 2 are headers
Row 1 has merged cells of A-F which says "Information" and then G-K " Tracking Section"
Row 2 is broken up into individual sub-headers in columns, A-K each one having a bit more info for instance:
Under the "Information" merged header in row 1 there is
A2 Name
B2 Work Center
C2 C/O date
D2 Due CC
E2 Due MX
F2 Date Received
and G-K in row 2 has different sub-headings.
I have tried to use my normal code, which is great for one header, but it ends up sorting the sub-header as I call it...
View 5 Replies
ADVERTISEMENT
Jul 19, 2007
what is the code to sort a spreadsheet in VBA code by HEADER rows?
i have 2 rows i want to sort by: first by Column D row 1, then by column C row 1.
Cells.Select
Range("C1").Activate
Selection.Sort Key1:=Range("D2"), Order1:=xlAscending, Key2:=Range("C2") _
, Order2:=xlAscending, Header:=xlGuess, OrderCustom:=1, MatchCase:= _
False, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal, DataOption2 _
:=xlSortNormal
Range("C2").Select
selects all cells, sorts, then de-selects.
View 3 Replies
View Related
Oct 7, 2009
In the worksheet "Batting and Pitching Register", I'd like to be able to sort the data in the two charts (APBA Batting Register and APBA Pitching Register) by simply clicking on the cells in the respective header rows.
I've set up ranges (Batting and Pitching), but have had no luck moving beyond that.
View 9 Replies
View Related
Jul 9, 2014
I have an issue with an export file which is produced in CSV format and needs to be aligned. I have attached a sample of what I refer to.
My Source excel file looks like:
ABC A-101 B - 202
DEF B-203 C - 100
The destination should align with the relevant column headers and place a blank if it doesn't match. Other have queried a similar thing, however my header and data and description is actually in the same cell with a dash separating them.
The output I want is:
A B C D
ABC 101 202
DEF 203 100
There are multiple row of employees with varied column headings as its dependent on what system access the user has. The headings i.e. A,B,C for example is a fixed number of headers.
In my real data set the headers represents a 3 letter system prefix e.g. ZCR,ILP etc
View 1 Replies
View Related
Jan 17, 2010
Attached is an example page. My goal is to be able to click on one of the header cells, and have it sort that column from high to low, and if I click that same cell have it sort from low to high. I know how to do this by making a command button, but, I want to do it by clicking on the cell itself. I just dont know how to do the onclick to execute the code.
View 3 Replies
View Related
Apr 14, 2008
Came across a spreadsheet that my firm created, where you can click on the column header and it automatically sorts ascending order for the column without messing up the other columns. Then if you double click it again, it will sort in reverse order.
View 9 Replies
View Related
Jul 25, 2007
I have a spreadsheet which contains a list of chemicals in Column A, and a list of numbers in Column B. The chemicals are separated into groups. I am trying to create a macro which sorts the chemicals in their groups by column B, so that the lowest number is at the top. I have 8 groups, and the number of lines in each group may vary, so I need to make the code dynamic.
I have attempted it. The way I thought it could be done was to search for the first group header, then save the address. Do the same for the next group header, then offset that by -1 row and 1 column, then sort using these two addresses as the range. The first part of the code works, where I find the address for both group headers, but everything after that doesn't work.
Sub Sort()
Dim CNMT(8) As String
Dim j As Integer
Dim fromRow As String
Dim toRow As String
Dim rng1 As Range
Dim rng2 As Range
CNMT(1) = "TPH Fractions"
CNMT(2) = "BTEX & MTBE"
CNMT(3) = "PAHs"
CNMT(4) = "VOCs"
CNMT(5) = "SVOCs"
CNMT(6) = "Metals"
CNMT(7) = "Inorganics"
CNMT(8) = "Pesticides"
For j = 1 To 8..................
View 2 Replies
View Related
Feb 25, 2009
I would like to create a list covering multiple columns.
I would like to have 5 columns which will contain the same value/ (word).
If I select,that value from the list, I would like to have each row the word is
found be displayed regardless of which row it is found.
View 7 Replies
View Related
Aug 6, 2008
In row 1 I want to have the names of servers, so we would have A C D E
Under each of those I want to have 4 other columns, so A would have on row 2 Start, End, Data, Time, or something like that.
Then B would have under it Start, End, Data, Time
And so on for C D ...
I would then want to sort it by the top level row, so if I had to insert B at the end I could sort it so it would be
A B C D E with all of the Start End Data and Time for the server to be moved along with it's master header.
I tried setting this up but then I went to sort it told me it could only sort if the columns were the same size, so having a merged top level A with four things under it did not work.
View 9 Replies
View Related
Apr 10, 2009
We have an issue with sorting rows of data that have formulas in them.
---------------
These formulas are using data from a row which is above the column headers.
For example cell H2 has 160 manually entered in it. It's the number of work hours available in January 2009.
The column header for that column is in Q4 and has a value of 'Jan'
Below this in cell H5 is the formula '=+H2' because the resource in this row is available for 100% of the month.
Another resource in row 22 has the formula '=+H2*0.15' in cell H22 because they are only available 15% of the time that month.
---------------
The problem occurs when we try to sort this data. Most of the cells displays #REF!. Some show a value, but the calculation is wrong.
View 8 Replies
View Related
Apr 3, 2014
I want to rearrange(sort asscending) columns based on numerical value in column header string through VBA macro. Please check attachment.
i.e. (Present Data)
# A B C D
1 col.1 col.4 col.3 col.2
(Output Data )
# A B C D
1 col.1 col.2 col.3 col.4
test.bmp
View 2 Replies
View Related
May 7, 2014
find macros to sort fixed ranges but not an entire column with existing header rows from 1 to 4.
Added to that is the need to keep the code compatible with Excel 2003 even though I have Excel 2010 at office (it's a file that needs to be "openable" in both versions so the vb code needs to be in XL 03.
Column currently starts at C5 but goes down to C47, at this point. But it's a growing list. Some of the rows are blank at the bottom, too.
View 2 Replies
View Related
Dec 2, 2008
I'm trying to merge 2 spreadsheets togeather but befor I can do this I need to resolve the following issue - my Excel worksheet has 2 columns with data that looks like this
Value1X1,X2,X5
I need it to change to this
Value1X1
Value1X2
Value1X5
View 5 Replies
View Related
Dec 5, 2012
I have three columns of data that I want to randomly sort by row. It's important that each of the three adjacent cells in each row move together, i.e.
Before assortment:
A1 B1 C1
A2 B2 C2
A3 B3 C3
After random assortment:
A2 B2 C2
A1 B1 C1
A3 B3 C3
View 2 Replies
View Related
May 22, 2013
I have a workbook (Sort Test.xlsx) where multiple rows belong to the same "group". Is there a way to sort by a value (e.g. name of the test, date of the test, etc.) while maintaining the formatting and keeping the "groups" together? There are 3 sheets in the work book. The first shows the sheet as is, the other two are examples of how I would like to be able to sort the data.
View 2 Replies
View Related
Oct 8, 2013
Any way to sort each row individually to move all data starting with letters "BML-" to first three columns? I have a document with data all over spreadsheet multiple rows and columns. But would like to move all cells that start with these characters "BML-" into first second and third column. I have been trying to accomplish it for over two weeks now without any success.
View 7 Replies
View Related
Aug 13, 2012
I have a big database, each row is having it's colour. How can I sort by colour? I mean, data with one colour comes first, then data with another colour comes after etc.
View 1 Replies
View Related
Jan 3, 2014
I need to sort groups of data by a single cell in the group, compared to other single cells in other groups of data. The groups are always the same number of rows but vary in the number of rows. There is an example file below. The red is the company name and the green is what I need to sort the group by, as compared to the other groups. This example only has a few, the real file has thousands of groups. I want to sort the companies by the totals in green...they are currently in alphabetical order. There must be a way to do this without going the VBA option.
View 4 Replies
View Related
Jun 23, 2006
I have a column of repetitive data:
BLANK CELL
NAME
ADDRESS
CITY, STATE ZIP
BLANK CELL
I would like to be able to resort the dats so that each line becomes a column
BLANK CELL NAME ADDRESS CITY, STATE ZIP BLANK
CELL
I know I can do it 3 cells/rows at a time using the paste special and
transpose command but I have a 1000 names and addresses. How do I do it in
one operation instead of a thousand?
View 9 Replies
View Related
Sep 16, 2008
I have a report that I drop down into Excel that is a transaction report for securities. The data for each security is in two rows. I would like to write a macro that would sort each two-line group by a certain cell in the group. If I could make the macro request the number of rows and columns in each range and the cell address of the cell to sort by, I would be able to use this macro for many different reports. Also, there has to be some way of telling the macro where to begin and where to end. I have some experience with macros although generally I "Frankenstein".
View 9 Replies
View Related
Nov 10, 2008
I have company asset data listed by item on wksht 1. Example:
Company A Computer 200
Company C Coffee Machine 21
Company A Car A123
Company B Computer 70
Company A Chair B14
Company B Desk C56
Company C Computer 59
Company C Desk C789
I want to sort and covert the column data on wksht1 to row data on wksht2. Example:
Company A Computer 200, Car A123, Chair B14
Company B Computer 70, Desk C56
Company C Computer 59, Coffee Machine 21, Desk C789
I'd like to do this via VBA/Macro(s) if possible.
I have to do this every month, so it would be nice to append the existing data to an "archive" file on wksht3 and then create this months data.
The data is imported each month via a text file with comma delimited fields which become the column data in the top example.
View 5 Replies
View Related
Feb 23, 2010
Once again, I'm seeking some further assistance to an issue that I have yet to resolve.
I have several rows of data which I'd like to be able to sort by the info in column "A".
The data rows are not all consecutive. The range for which the data resides are:
Range("A25:A73,A85:A105,A145:A193"), When I sort I want my data to stay within these limits/ranges.
View 8 Replies
View Related
Nov 26, 2008
I would like to ask if it is possible to sort a range of row? What I mean is, if I sort like Row 1, the entire block of row 1 will move as well? Like if i have column A to F, then row 1 of column A to F will move together at the same time.
View 3 Replies
View Related
Jul 29, 2009
I imported data into Excel. The first row is a header row in A1 it is fine until the next header row in A12, A23, A34 all the way down to many rows. The problem is the header rows are overlap with other data by seperating with couple of spaces. I need a VBA to move a whole header characters to it own row just right after couple spaces. See the attached for more detail.....
View 2 Replies
View Related
Mar 4, 2010
I havet he following code which sorts data. If there is no data to sort I keep on getting a run time error. Could I add something to my code to prevent the run-time error, as sometime there won't be any data to sort. The code runs when I switch to the worksheet in question.
Sub SortMeetings()
Dim iCTR As Integer
Dim yCTR As Integer
Dim zCTR As Integer
zCTR = 11
For iCTR = 12 To 23
For yCTR = 1 To 10
If Len(Range("D" & iCTR).Offset(0, yCTR)) 0 Then
Range("AA" & zCTR).Value = Format(Range("D" & iCTR).Offset(0, yCTR), "HH:MM") & " " & Range("D" & iCTR).Value
zCTR = zCTR + 1
End If
Next yCTR
Next iCTR
Range("AA11:AA" & zCTR).Select
Selection.Sort Key1:=Range("AA11"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
End Sub
View 9 Replies
View Related
Jul 18, 2008
I have a worksheet with 30 sets of 3 columns, each column has 20 to 30 rows in use for the same realitive data. I want to get the sum for each 1x across 30 sets of the columns. I am checking vs if it says Projected or Actual. My Visual Basic macro ability is very limited at best. I have a totals row for each row of data so i can see totals for 1x over 30 days, 1.5x over 30 weeks, and 2x over 30 weeks.
Here is the basic idea of what i am dealing with:
A B C
Projected (merged across A, B, and C)
1x 1.5x 2x
8 4 1.5
7 0 0
8 2 0
8 4 5
Again, this represents one day, and I am trying to track at least 30 days across 90 columns. Also there are anywhere from 20 to 30 people being tracked at any one time so this continues to many more rows depending on the job.
Please help, it would be greatly appreciated.
View 9 Replies
View Related
Dec 28, 2011
I have a subroutine to delete non-header rows. This sub routine seems to choke on the delete line.
Code:
Sub CleanSheets(Header As Integer, WorkSheetToClean As Worksheet)
Dim WorkSheetRows As Integer
WorkSheetRows = WorkSheetToClean.Cells.Find(What:="*", SearchOrder:=xlRows, SearchDirection:=xlPrevious, LookIn:=xlFormulas).Row
WorkSheetToClean.Rows(Header, WorkSheetRows).EntireRow.Delete
End Sub
View 3 Replies
View Related
Aug 27, 2008
I am trying to understand how to simply COPY the Header Rows from one sheet to another sheet.
The first four rows have the report heading with the fourth having the column titles.
View 9 Replies
View Related
Jan 6, 2007
i am trying to come up with some code to print many sheets in a workbook based on user clicking a button on each sheet.
I would like the code to be reusable and based on the activesheet, this way I don't need to write code specific for each sheet.
My first thought was to use something like ActiveSheet.UsedRange, but the rows may span several pages, so I'll need the header row to repeat on each page
Here's a snippet I recorded
ActiveSheet.PageSetup.PrintArea = "$A$2:$E$12"
With ActiveSheet.PageSetup
.PrintTitleRows = "$2:$2"
But I can think of a way to use UsedRange but drop out about rows 1-4 which do not need to be printed on the reports
Number of Cols varys on every sheet as well and diff start/stop cols
Ex one sheet A:G, another sheet C:T
View 9 Replies
View Related
Feb 12, 2014
I want to filter my dataset, select column B & C to copy, but exclude the header row. I am having a hard time offsetting the selected range. I get a compile error on what I try.Here is my code (yes, I know, its a little juvenile and I will clean it up, but I need to see things clearer at first):
Sub GetBarrelQualifiers()
'
' GetBarrelQualifiers
[code]....
View 5 Replies
View Related