I have the simple code below to perform and filter and copy:
Code:
Sub Macro1()
Sheets("Data Dump").Select
Range("A1:F100000").AdvancedFilter Action:=xlFilterCopy, CriteriaRange:=Range( _
"K1:L73"), CopyToRange:=Range("P1:U1"), Unique:=False
End Sub
However, the CriteriaRange can change depending on which OptionButton the user chooses on a different tab. My reference the range is in Cell N1. So how can I use Indirect to refer the range in Cell N1 instead of the current CriteriaRange of K1:L73?
I have a condition in advanced filtering as >90%. However, I would like the "90%" to be calculated via a formula in another cell and this condition to reference it. Is it possible?
I need a formula that will tell me which 'BPS' a person should receive based off of the count of loans closed (between 'Criteria 2' & 'Criteria 2.1' and/or the volume (total of 'Loan Amount')(between 'Criteria 1' & 'Critera 1.1'), whichever gives the person a the higher tier.
I have provided an example below. In the example John Doe should receive .01750 'BPS' because he closed over 1 million in volume. If, for example, John Doe closed 5 loans for 400,000, then he would receive .01600, since he met the criteria for the 2nd tier based off of # of loans closed.
The formula needs to take into consideration which 'Comp Plan' the person has, as well as the other criteria mentioned above.
in my workbook i have 3 sheets named "time" "final" "push". in the sheet thats named "final" ihave in cells B2 and C2 2 values that correspond to a type interval (lets say 75-378) in the sheet "time" each row represents 1 sec, starting at one.
what i would like to do is locate the interval defined by the 2 values on "final" sheet and find the min max and value in column S of the "time" sheet.
i.e if B2 and c2 said 78 and 378 it would go on "time" sheet select the range of S78-S378 and find the mean, the max and the average and report them in sheet "final" in cells E2 F2 G2 respectively What would be optimal is that there was a way to perhaps loop so that it can do the same thing with the range defined by the values in B3 and C3.
I need a formula (or formulas) to give me the "coordinates" (Column & Row location) of a certain value in a large rectangular range. Intuitively this should be doable with a smart combination of VLOOKUP, HLOOKUP, INDEX, MATCH, ADDRESS and/or CELL functions (maybe in the form of "array formulas") but I can't seem to find the way...
Here is an example of what I need:
I have a large rectangular range (A10:F500), full of numerical values. Then in cell A1 I have one of the (many) values contained in the range, let's say, 3.14159. I need two formulas that give me the following:
a) A formula in cell B1 that tells me in which COLUMN of the range the value 3.14159 is located a) A formula in cell C1 that tells me in which ROW of the range the value 3.14159 is located
If the range consisted of a single column (or a single row), this would be an easy INDEX and MATCH combination.... but I'm dealing with a *rectangular* range here...
the reason why my range declaration is so strage is because i was trying to change the dimensions of the range with an offset function because i had many ranges to average but the offset function didnt want to work. this way goes like this....................
I am new to VBA and have tried to develop the code for finding a specific stock symbol (Column A) from over 4200 symbols from a downloaded csv file, copy the data in in its (specific symbol's) row (in the next 5 columns B to F) to the 3rd blank row in the master workbook (data arranged from Bottom to Top). In the Master workbook each stock symbol has a worksheet with its symbol as the tab e.g. BHP.AX is the tab or sheetname for BHP stock in the Australian Stock Exchange. The downloaded file comes from a subscribed site EODData which provides daily OHLCV (Open/High/Low/Close/Volume) data against each symbol.
My attempt is shown below and it is very primitive. It does not work! I wish to run it from the Master workbook (name:-0PortfolioASXMultipleIB.xlsm) and not from Csv Data file.
VB: Sub Macro0CopyFromCSV() 'Insert a blank row and format it in Master workbook Rows("3:3").Select Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
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.
I found a great bit of Advanced Filter code that works great, and fixed a problem of clearing a cell breaking the filter.
But if I want to increase the criteria from 1 row to 2, so you can start to include And , Or operations, it breaks the filter. Even an attempt at a manual one fails, until you put the criteria range back down to one row, then it's fine again.
I've tried changing the Target Row to >2 but that didn't work. how to make the criteria range bigger, and no problems of breakage if you clear the cells? It makes for a very useful automated Advanced Filter.
Here's the code :
[Code] .....
Database = the named area of raw data. DATA is the name of the raw data worksheet The criteria range should be AZ1:BC3, but of course royally breaks it...
I am trying to develop an Indirect Indirect Validation drop down list. Example, Building - Floor - Room, i.e. Select Building from a Validation drop down list. Then based upon the Building selected, select only the Floors applicable to the Building Selected. I am able to achieve this via an Indirect Validation drop down. However, when I attempt to then select the Rooms applicable to the Floor of the Building I selected, I can not produce an Indirect Validation off a previous Indirect Validation.
In the attachment, I have used Plant - Location - Room. I have name ranged the selections, and have used Validations Lists for Plant, and Indirect Validations for Location. The error occurs where I attempt to do an Indirect Validation for Room.
In the example I have attached there are two sheets, Details and DataTables. There are also a number of named ranges, both static and dynamic, that refer to data on the DataTables sheet. Most of the static ranges were added for debugging purposes. The tables have been shortened for this example.
On the Details sheet column A has a drop down that allows you to select the make of a device. Column B builds its drop down list based on what is selected in column A. The data validation in B2 uses a named dynamic range and the drop down does not work. The data validation in C2 used a named static range and the drop down works.
Column C will fill in the RU value based on what is selected in column B. Cell C3 uses named dynamic range and it does not work. Cell C4 uses named static range and it works.
I would like to used named dynamic ranges if possible so when data is added to the tables the named dynamic ranges will self adjust. Can what I want to do be done?
I'm trying to use Indirect in a formula where named range refers to multiple non adjacent cells; e.g. ever other cell {A1, A3, A5... etc}; however, when I use indirect, I recieve a #ref error. Replacing the indirect with the actual named range will make the formula work just fine, or using a named range that a continuous range works fine as well. It seems that indirect doesn't like non continuous ranges. ?
is an indirect range that resides in cell B15. It is constantly changing and the expectation is that the X_Y plot would adjust accordingly. It represents the data range of the chart. The chart does not carry with it any title.
So how do I approach this without using vba? As always any input is highly valued.
I have a formula: ='Jan 7-11'!D10. I want to replace the tab name 'Jan 7-11' to change based on the content of F6 (which is a data validation for all tabs in my workbook).
I am using VB in Excel to write a formula for summing a column of numbers that will vary in length. I have been using the Indirect formula and have the start and end cells of the range identified in another location. My problem is, the macro in vb is sending the Indirect formula to the cells containing the start and end points by using relative functions ie. go across 30 columns and up 10 rows to get start cell. I wanted it to just save the cell location of the start and end points. EG.
VB formula is: "= SUM(INDIRECT(R[-23]C[27]&R3C29):INDIRECT(R[-23]C[27]&R3C30))" whereas I just want it to read "=Sum(Indirect(C4&D5):INDIRECT(C4&D6))"
where cell C4 gives the column letter and D5 the row number of the start of the range and C4 and D6 give the column letter and row number of the end of the range.
How would I used the indirect function to reference a named range in the workbook in formula creation.
For instance, if in cell A1 I have entered the text "Sales" which is also a named range in the workbook. Then in cell A2 I tried entering the following formula to sum based on the entry in cell A1 using the indirect funtion. For instance:
=sum(indirect(A1))
In this instance I was hoping this formula would then sum the amounts in the "Sales" named range. And, if I changed the text in cell A1 to "Cost" for instance (another named range in the workbook), it would sum the amounts in the "Cost" named range. Allowing for a dynamic formula based on the entry in cell A1.
I am trying to use the INDIRECT function to look up values on a range of other worksheets. I have a column of data in col A which is essentially a lot of different worksheet names. On each worksheet I need to use VLOOKUP to find a value.
Easier to show formulas. This is an example of what I want to recreate:
=VLOOKUP(O2, test!B3:C13,2,FALSE)
I want to replace the text "test" with the text in column A. So the first INDIRECT formula looks like this:
=INDIRECT("VLOOKUP(O2, " &A1& "!B3:C13,2,FALSE)")
Which to me looks like it should work but I get a #REF! error. I've tried various permutations, e.g. having the INDIRECT part of the formula located in a different place (next to the "test" text) but run in to similar issues.
The formula is =SUMPRODUCT((Group="A")*(Project_Description="Long Term")*(Profile="B")*(INDIRECT(B9)="x"))
B9 through M9 have header text Jan_2012, Feb_2012...Dec_2012. Basically my aim is to get the above formula working before I drag it across so that the named ranges get picked up automatically from the headers.
Jan_2012 thru Dec_2012 are dynamic named ranges using INDEX (and not OFFSET as someone mentioned OFFSET is a volatile function).
The above SUMPRODUCT formula is giving me a #REF! error for the (INDIRECT(B9)="x") part. I know that because when I replace it with (Jan_2012="x") it works fine.
I realized while writing this that it may be because the named range in Jan_2012 is not the same size as that of other arrays. [but it is the same size - I've re-confirmed just now]
I am trying to write a sum formula using Indirect so that the end-user can enter the names of the sheets in B1 & B2 (the values are always in cell F5 on each sheet). I thought this would work but it is throwing a REF# error.
I am using the following VBA code each month to filter some data, and then copy the filtered data to another worksheet. Can anyone please advise how I can copy and transfer the filtered data, as the number of rows in the filtered data will always differ.
Sub FilterTo2Fields() With Sheet1 .AutoFilterMode = False With .Range("A1:E1") .AutoFilter .AutoFilter Field:=1, Criteria1:="Bingo" .AutoFilter Field:=4, Criteria1:="Sydney" End With End With End Sub
after applying a filter I would like to paste to all rows from C to E.
The paste part of the code isn't important as I already have grabbed it.
But what I need to do is to paste it to all the rows in the 3 columns. The number of rows will always be different, and sometimes there will be no rows (so I can't use the xlDown function. I also don't want to paste over the header row (row 1)
So I would like that i can have a filter in the cells of Criteria Column, as for Example I would like to select High, Medium, Low for each country and not the other criteria...so have a filter in each cell!!
So Albania would be in a row and would have to filter (High, Medium, Low, Average, Top).
i want to display the results of one criteria using VBA codes instead of just filtering one by one to display the result and collate it. I have attached the sample. I want to find the "subcodes" of name "kathy". to be able to do that, i filter "kathy" to display all the "codes" then filter all the "codes" to find the "subcodes". is there vba code for this one so that when i input the name, all the subcodes will be displayed?
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.
I'm trying to build a report whereby i collate the first punch in and the last punch out from a set of data.
This is a sample data: 02-May-1409:00 02-May-1419:14 05-May-1409:31 05-May-1419:38 06-May-1409:31 06-May-1412:56 06-May-1413:10 06-May-1420:11 07-May-1408:36 07-May-1412:45 08-May-1408:45 08-May-1412:35 08-May-1413:23 08-May-1419:54
My result should be the following: 02-May-1409:00 02-May-1419:14 05-May-1409:31 05-May-1419:38 06-May-1409:31 ***these cells should be filtered out 06-May-1420:11 07-May-1408:36 07-May-1412:45 08-May-1408:45 ***these cells should be filtered out 08-May-1419:54
This error occurs after I wanted to use the Auto-filter function for every row. I used to separate the merged cells that used to be into single cells. After that the compiler reports error. Here is the code: