Sort And Filter Dynamic Range On Different Sheet

Apr 4, 2014

We have 2 dynamic ranges (input, output) on different sheets (sample data below).

Sheet1> Input
Dynamic range 5 columns

Sheet 2>Output
Dynamic range 4 columns
- Include only rows IN=1
- Sorted by LEVEL (BIG to SMALL) and BUY (SMALL to BIG)
- Keep duplicates

What formulas should I place on Sheet2 avoiding Pivot tables or VBA?

Sheet1> Input (16 data rows)
A B C D E
Level Buy Sell Firm IN
16620 4.00 null F1 OUT
16610 5.10 0.80 F1 OUT
16600 11.40 6.60 F1 1
16590 24.50 18.60 F1 1
16580 44.90 37.10 F1 1
16570 66.90 59.60 F1 1
16560 84.40 78.70 F1 1
16550 95.00 90.30 F1 1
16540 99.80 95.60 F1 OUT
16530 100.00 98.00 F1 OUT
16611 6.66 0.497 F2 OUT
16600 9.09 1.96 F2 OUT
16589.1 20 12.5 F2 1
16578.2 41.66 33.33 F2 1
16567.3 73.33 65.21 F2 1
16556.4 90.9 84.61 F2 1
16545 98.5 91.66 F2 OUT

Sheet2> output (10 data rows)
A B C D
Level Buy Sell Firm
16600 11.4 6.6 F1
16590 24.5 18.6 F1
16589.1 20 12.5 F2
16580 44.9 37.1 F1
16578.2 41.66 33.33 F2
16570 66.9 59.6 F1
16567.3 73.33 65.21 F2
16560 84.4 78.7 F1
16556.4 90.9 84.61 F2
16550 95 90.3 F1

View 6 Replies


ADVERTISEMENT

Sort / Filter Rows: Sort A Range Of Row

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

Dynamic Named Range Sort Including Cells Outside Defined Range

Apr 3, 2008

Im sorting a dynamic range as mentioned in this Sorting a Named Range. My range is called drWarningTypes and is defined as:

=OFFSET(DataSource!$A$2,0,0, COUNTA(DataSource!$A:$A)-1,1)

When there is only one cell in the range, then running the following sort function includes A1 also in the search (and also adjoining columns).....

View 9 Replies View Related

Macro To Sort Dynamic Range?

Jun 6, 2013

I have a Ranking tab that has the persons name, weeks, months that subtotal into 2 columns, MTD and YTD. I have set up with 2 Macros to sort based on two columns based on their selection of MTD or YTD.

What I did not take into consideration is if a person was added at the bottom of the list.

Is there a way to modify this to include rows that may be added?

VB:
[SIZE=4]CODE HERE[/SIZE]
VB:
[B]Macro1
[/B]Sub SortYTD()

[Code].....

View 8 Replies View Related

Sort Dynamic Data Range

Apr 8, 2014

How might the code below be changed to handle any number of rows? Right now it's set (from a recorded macro) to go down through row 237, but I need it to sort anything from just a few to maybe a thousand.

Cells.Select
ActiveSheet.Sort.SortFields.Clear
ActiveSheet.Sort.SortFields.Add Key:=Range("C2:C237"), _
SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
ActiveSheet.Sort.SortFields.Add Key:=Range("B2:B237"), _
SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
ActiveSheet.Sort.SortFields.Add Key:=Range("K2:K237"), _

[code]...

View 5 Replies View Related

VBA To Filter And Format A Dynamic Range?

Jul 3, 2013

I have a spreadsheet with columns A to X.

There are about five variables which, when entered, should format the row their on. For example, if I select "Waiting List" from a dropdown in column A, the row is formatted to have a blue fill.

I'm currently using this code:

VB:
Sub waiting()
Dim sh As Worksheet
Set sh = Sheets("Applications")
sh.Range("A1:X1").AutoFilter Field:=2, Criteria1:="Waiting List"
sh.Range("A2:X2" & sh.Cells(sh.Rows.Count, 1).End(xlUp).Row).Interior.ColorIndex = 37
sh.ShowAllData
End Sub

I have five such macros.

The problem I am having is that when there is no entry for the macro to work on, it just formats rows 2-21 anyway, and overwrites any other formatting.

I have attached my workbook so you can take a look and see what I mean. Firstly, select "Waiting List" in cell B2, then run the macro "waiting". It should work fine.

Then, delete the content of B2, and run the macro again.

View 3 Replies View Related

VBA To Update Dynamic Range In Filter

Mar 10, 2014

I have below VBA code which I recorded in order to do the selection of filter value.

[Code] ......

But how can I make range in above code to be dynamic? Because every time data would be different so range would vary..

View 4 Replies View Related

Dynamic Range For Advanced Filter

Jul 28, 2006

I am writing a VBA code to make an advanced filter. Instead of a fixed criteriarange, I would like it to be dynamic. As each time the number of criteria is different.

e.g.
Range("A1:G30").AdvancedFilter Action:=xlFilterInPlace, CriteriaRange:=Range("L1:L18"), Unique:=False

I want the criteriarange to change. e.g. It include all the data if I put in 20 data in col L.

View 2 Replies View Related

Advance Filter With Dynamic Criteria & Range

Dec 4, 2008

I bring in data with these same columns A thru J. I do not know how many rows will be comming in. I have create a macro that uses the advanced filter. I have a criteria range set up on sheet 2 with 6 variables, the main data is on sheet 1. This works fine if I use all 6 variables. I wish I could select from a list box which of the 6 or all variables I need(I might select 2,3 or more variables), & have that information populate the criteria range. I only filter in place(no copying), there is only filtering on column B, the label for the criteria range will always be "Name" it will be located on sheet 2 D:1. Is this possible or should I be trying some other function? Here is the macro that uses all 6 criteria. I have searched and could not find what I was looking for.

'add criteria range
Sheets("Sheet2").Select
Range("D1").Select
ActiveCell.FormulaR1C1 = "Name"
Range("D2").Select
ActiveCell.FormulaR1C1 = "e11*"
Range("D3").Select
ActiveCell.FormulaR1C1 = "e12*"
Range("D4").Select.........

View 9 Replies View Related

Sort And Filter Range With Protected Cells

Nov 9, 2008

Is there any way to allow autofiltering and sorting even with locked cells within the range to be sorted? I've conditionally locked some cells based on user input, and at the end of my vb code I have allowsorting and allowfiltering. But I want to sort cells that are locked even after that. Does anyone know if that's even possible with VB?

View 4 Replies View Related

Getting Sort Function To Work On Defined Dynamic Range

Dec 13, 2012

Essentially i get a Runtime 5 error on the bold bit of code....

I am trying to define a range .... by using thexlUp function find the last row ( which works ) i then pass this variable into the sort code and get the error its probably very simple to fix, all it does i sort columnA but finds the last cell .... instead of the whole column,,,,

Sub Macro7()
'
' Macro7 Macro
'
' Keyboard Shortcut: Ctrl+e
NumberOfRow = Sheets("Sheet1").Range("A3000").End(xlUp).Row
ActiveWorkbook.Worksheets("Sheet1").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Sheet1").Sort.SortFields.Add Key:=Sheets("Sheet1").Range("A2", Cells(NumberOfRow)), _
SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal

[Code] .......

View 2 Replies View Related

Filter Results Of Primary Filter Sort

Feb 11, 2008

I am in the process of making a database more efficient and am running into a problem with sorting data. I currently am trying to use AutoFilter to sort the data. When I want to then narrow the results further using the same column as the critical and there is nothing that matches the critical, I get everything from the entire database that matches that critical rather than what I want to see, which, in this case, would be nothing.

I have attached a sample file. In it, when All AF 1000 is run and then Selected MAC 2000 Wash is run, I want to see no results instead of seeing all MAC 2000 Washes from the original data set. I can do it using IF/THEN but I am looking for a faster way to do it.

View 3 Replies View Related

Sort Range On Non Active Sheet

Dec 22, 2007

I'm trying to sort data on sheet1 and sheet2. I'm running all macros from sheet one and I need it to stay active all of the time. I'm using the following code to sort sheet2. When I sort the column on sheet2 with the code, I can not get back to sheet one without an error.

Worksheets("Sheet2").Activate
Columns("a:a").Select
Selection.sort Key1:= Range("a1"), Order1:=xlDescending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal

I've tried

Worksheets("Sheet1").Activate
Columns("a:a").Select..............

View 2 Replies View Related

Copy And Pasting A Dynamic Range From One Sheet To Another?

Aug 5, 2014

I'm trying to copy a range of column headers from one worksheet and paste them in another using a macro
The source range starts at Q1 and runs along row 1 for a variable number of columns each time.The destination cells start at B1 and will run along row 1 for the same number of columns.

I've got as far as counting the number of source columns

PHP Code: 

Dim LastDate As Long

LastDate = Sheets("Edited data").cells(1, Columns.Count).End(xlToLeft).Column 

how to paste to a changing number of columns

PHP Code: 

 Sheets("Edited data").Range("Q1", cells(1, LastDate)).copy Destination:=Sheets("Variety Total").Range("B1", ????) 

View 2 Replies View Related

Link Dynamic Named Range To Another Sheet

Apr 9, 2008

I have a dynamic named range named db in sheet1. I need to have the same range linked to sheet2 starting in cell A1.

View 3 Replies View Related

Copy Auto Filter Range To Another Sheet

Jun 7, 2008

I want to filter the data: [the data I have In "Sheet1]"

Sub Makro5()
Selection.AutoFilter
Selection.AutoFilter Field:=1, Criteria1:="5"
Selection.AutoFilter Field:=2, Criteria1:="6"
Selection.AutoFilter Field:=3, Criteria1:="7"
Selection.AutoFilter Field:=4, Criteria1:="99"
End Sub

and now I want to copy from "Sheet1" to "Sheet2" but only Field:=4, where criteria1:="99"; In "Sheet2" I want to paste my filtered data to:

Range("B1,D1,F1,H1,J1,L1,N1,P1,R1,T1,V1,X1,Z1," & _
"AB1,AD1,AF1,AH1,AJ1,AL1,AN1,AP1,AR1,AT1,AV1,AX1,AZ1," & _
"BB1,BD1,BF1,BH1,BJ1,BL1,BN1,BP1,BR1,BT1,BV1,BX1,BZ1," & _
"CB1,CD1,CF1,CH1,CJ1,CL1,CN1,CP1,CR1,CT1,CV1,CX1,CZ1," & _
"DB1,DD1,DF1,DH1,DJ1,DL1,DN1,DP1,DR1,DT1,DV1,DX1,DZ1," & _
"EB1,ED1,EF1,EH1,EJ1,EL1,EN1,EP1,ER1,ET1,EV1,EX1,EZ1," & _
"FB1,FD1,FF1,FH1,FJ1,FL1,FN1,FP1,FR1,FT1,FV1,FX1,FZ1," & _
"GB1,GD1,GF1,GH1,GJ1,GL1,GN1,GP1,GR1,GT1,GV1,GX1,GZ1," & _
"HB1,HD1,HF1,HH1,HJ1,HL1,HN1,HP1,HR1,HT1,HV1,HX1,HZ1," & _
"IB1,ID1,IF1,IH1,IJ1,IL1,IN1,IP1,IR1,IT1,IV1")

View 2 Replies View Related

Copy Data From One Sheet To Another With Dynamic Range Selection?

Feb 21, 2011

The CRM application that we use provides output in an excel sheet "Table View 1". I want to be able to copy the data that is dumped to a sheet to another sheet. The requirements:The data output range is different. Sometimes it is 4 rows and sometimes it is 25 rows. I want a mechanism where based on the output, the formula/macro automatically copies the information to the new sheet.The first 2 rows need to be excluded when the copy is being made.

View 6 Replies View Related

VBA Copy Dynamic Range From Multi Sheet To Sheet3

Oct 25, 2012

I am trying to copy a range of valid cells "non-blank" from "sheet_a" ,"sheet_b" ,"sheet_c" to "sheet3" i was successful to copy from one sheet only. how to copy from all the sheets listed from the same workbook.

following is the VBA code i am using

Sub CopySample()
Dim shSrc As Worksheet
Dim shDst As Worksheet

[Code]....

View 1 Replies View Related

Automatically Sort Range On Leaving Sheet (Deactivate)

Apr 24, 2008

I'm trying to do something quite simple but I can't seem to see the forest thru the trees.

All I want to do is when I deactivate a worksheet (sheet2) I want it to sort a predfined range. I keep getting a "Select Method of Range Class Failed" error message on the line of code with ******

The code is as follows: ...

View 5 Replies View Related

Dynamic Lookup Formula - Retrieving Result From A Set Of Range From Other Sheet

Sep 27, 2011

I have a query on retrieving the result from a set of range from other sheet.

Query: In the Sheet1 Column B has to take first two words from the
Column A & lookup the matching results from Sheet 2.
(The search range should be the first two words of each cell)

Result: The complete sentance in the Cells (First Two words) should get placed in the Sheet1 Column B

Example: The Expected result should be as mentioned below. (Blue in color should be the results)

Sheet1A BC1NameResults2abc def fkfeabc def words3ghi jkl kikgN/A4mno pqr stu lkasmno pqr must work5
Don't give my book don't give up6vwx yzyvwx yzy not7xwv uts rqpxwv uts yes8omn lkjN/A9ihg fed cbaN/A

Sheet2A BC1Lookup Data2abc def words3xxxghi jkl4yes you have to5don't give up6no you will not7mno pqr must work8vwx yzy not9Excel work10xwv uts yes11omn mre lkj12ihg not fed 13not work14

This is my query

View 7 Replies View Related

Can't Sort Or Filter

Apr 5, 2010

I have a worksheet of 10 Columns and over 5000 rows. The worksheet has the word {Group} in brackets after the file name. When I pasted this worksheet into an old file I have been using for a long time it added the word {Group} to this file also.

I am unable to use sort or filter on this worksheet as they are both grayed out.

View 8 Replies View Related

With Sort And/or Filter

Jan 23, 2010

I have two columns of numbers. The first column is numbers of customers seeking specific products. The second column is of total competitors for the products. I am wanting to find a sort or filter that will show me the "sweet spot" where I can "weight" the best products that have greatest seekers but lowest competition.

Here are a few examples of what I am working with:

Product a - People seeking product: 167 / Competitors providing product: 5740
Product b - People seeking product: 111 / Competitors providing product: 133000
Product c - People seeking product: 74 / Competitors providing product: 105000
Product d - People seeking product: 60 / Competitors providing product: 109000
Product e - People seeking product: 33 / Competitors providing product: 22200

(I have many more products than this, this is only a small example)

So what my goal is is to run through all my data and find the most ideal products (the "sweet spot") that have greatest number of seekers/potential customers with the least competition.

Is there a way to sort this? Or do I use a filter of some type. My knowledge of Excel is pretty minimal.

View 9 Replies View Related

Automatic Dynamic Sort

Jan 11, 2008

I have a spreadsheet that ranks the 500 components of the S&p 500 on an ongoing intraday basis. I would like to have the sheet sorted automatically as it is updated. I have very limited VB skills. Also, I heard there is a feature on excel 2007 that performs this function.

View 7 Replies View Related

How To Name A Dynamic Range & Make A Validation List (of 2 Dynamic Ranges)

Dec 22, 2009

I have a range which will change in size & in content, & I want this to be a Named Range at whatever size it is.

Reason I want to is because I want to make a Validation List with this dynamic range. I also want a Validation list which lists the content of 2 or more dynamic ranges which may or may not be on the same worksheet - is this possible?

i.e.
First dynamic range: called "Milestones" at A11
Second dynamic range: called "Activities" at A25
& make a Validation list that will list content of both

View 9 Replies View Related

Dynamic Advanced Filter

Jun 21, 2006

I am trying to create a function using vba and the advanced filter function.

The spreadsheet I am using changes from week to week so it can have different amounts of columns and also rows.

This is my code.

Sub FilterCGML()

Dim rngToFilter As Range
Dim rngFilterCriteria As Range
Dim LastRow As Long, LastCol As Integer

With Sheets("Main FTE")

Range("b2000").Value = "Cost Code"
Range("b2001").Value = "5*"

It works ok if I have values in columns A:X but if for example I only have information in A:S I get a runtime error.

I know how to find the last column and last row by using


LastRow = ActiveSheet.Range("A" & Rows.Count).End(xlUp).Row
LastCol = Range("IV1").End(xlToLeft).Column

But I don't know how to modify my code to use these.

View 4 Replies View Related

Auto Filter Won't Sort

Mar 18, 2007

For some reason I have a worksheet that won't sort stuff by Autofilter any more. I built it as a customer database but for some reason today I just can't get the names to ascend or descend. there is something simple I can check for, I can post an empety sheet if needed but right now I can't really post a list of all my customers info.

View 5 Replies View Related

VBA Macro To Filter And Sort

Aug 6, 2008

I'm tryin to set up a macro to filter and sort and when I record the macro correctly it does not run properly.

I have detailed info below:

I created a sheet "Met Logbook" which contains all links to the source "Master Logbook". This master logbook has a lot of info added daily and we add info at the top of the sheet (we insert new rows every time at the top for different reasons). So what happens is the master logbook always changes its cells (when inserting new rows at the top, all the cells change row number). So I have just linked all the cells and more that we may be using in the Met logbook. This is why I need to filter and then sort the Met logbook (since there will be so many blanks, unuseful info and in the wrong order). (It will be in the wrong order because the "master logbook" has newer info at the top and I have more than one sheet of info for the master logbook) (so my links in the met logbook are somewhat out of order).

So what I need is to have code to filter column B with:

and column H with "Blanks", then I need to sort column A (rec'd) in descending order (so that newer info will be at the top). I will post my Met Logbook sheet on my second post since its a little large.

View 49 Replies View Related

Sort And Advanced Filter

Jul 13, 2006

I am trying to perform a function that searches through the first column for any active "A" account and then copies the corresponding rows information into another worksheet. I think I need to use the advanced filter function however I can't seem to figure it out.

View 9 Replies View Related

Automatic Sort After Filter ...

Mar 21, 2007

I'm trying to write one macro that filters a set of data based on 2 criteria and then automatically sorts the filtered data by date. The filter works fine but when I then try to write code that handles the automatic sort, I get the following message when I run the macro: "Run-Time Error 1004: the sort reference is not valid. Make sure that it's within the data you want to sort, and the first Sort By box isn't the same or blank."

I realize it would only take one or two more clicks to sort this data manully after the macro is run, but the lazy person in me is trying to eliminate this step. Does anybody have any suggestions as to why the sort is not working? I parsed basic sorting code, but it hasn't worked. The other part of this that is causing me trouble is that the number of filtered rows will vary, so I'm only needing to sort the visible range.

View 9 Replies View Related

Filter With Formula: FILTER A Range And Display The Unique Items, One Below The Other, WITHOUT Blank Cells

Feb 10, 2008

How can I FILTER a range and display the unique items, one below the other, WITHOUT blank cells - with only a FORMULA. What I came up with is shown in the attached WB. I would like to present the countries like in C11:C15.

View 5 Replies View Related







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