Name A Dynamic Range With 2 Columns
Jun 28, 2014I have data in 2 columns on which I need to do vlookup. This range for vlookup increases. I want to name this dynamic range. How do I do it?
View 1 RepliesI have data in 2 columns on which I need to do vlookup. This range for vlookup increases. I want to name this dynamic range. How do I do it?
View 1 RepliesI'm trying to name a dynamic range for A2:B10000.... I know how to use the OFFSET function but was wondering to do it using the INDEX function
Both column will always have the same number of used rows.
Another question:
If I have dates in Column A, and values in Column B....what formula do I need to get me the last value (last row,most recent Date)
create a Dynamic Named Range for Pivot Tables
the pivote table takes data from A1 to Kx
x is the last row of column K that is not 'blank' ( whenever I insert a new row),
I already know how to define a zone but not know how to to make it "dynamic"
How would I modify this macro to handle a Dynamic Named Range In the example below A27 is the last row in my data set, but its last row number is dynamic.
I'm using this code just after finding the last row in the dataset, but found it breaks if the last row doesn't fall in the A27 range.
I find the last row prior to executing the TextToColumns code.
Range("A65536").End(xlUp).Select
Sub TextToColumns()
Selection.TextToColumns Destination:=Range("A27"), DataType:=xlFixedWidth, _
FieldInfo:= Array(Array(0, 1), Array(3, 1)), TrailingMinusNumbers:=True
End Sub
I need a macro to start at cell A11 and select across 10 columns and down to the Lastrow (last row with any data).
There are hidden columns after column D so it CANNOT have any columns hardcoded except for column A.
This selection then needs to be set as a single print area to print out on 1 page. I have already set Rows 1-10 as a title area to print at the top of each page.
Code i currently have is:
[Code] .......
I just need it to now go across 10 visible columns and set as a single print area.
I am still trying to develop a macro that will copy and paste a set of formulas into a dynamic destination range. I have included a worksheet that shows what I am trying to do. Basically when using AutoFill I need the columns of the destination range to be dynamic based on the number of rows in another sheet.
View 13 Replies View RelatedI 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
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).....
I have a column of data that keeps getting new information in it. what i need is a named range that i can use for a chart, first point in the named range will be the first value in the column, second point will be avg. of point 1 and 2, then 3rd point will be avg. of 1,2,3 etc.
View 1 Replies View RelatedI am trying to get to grips with the dynamic ranges for pivot tables. I have named a range data and in the refers to section put:
=OFFSET(Sheet2!A1,0,0,COUNTA(Sheet2!A:A),COUNTA(Sheet2!1:1))
I was hoping that then when i go to data > Pivot table and it asks for the range i could put =Data but it tells me that the range is invalid. I have attached a copy at the bottom.
My searches have not produced anything that I could apply to this situation.
I'm trying to write VBA that would:
1. Search a Workbook for Dynamic Ranges.
2. When a Dynamic Range is found the code would:
A. Determine the current coordinates for the range.
B. Change the "Refers To" value From "=OFFSET...." To "=Worksheet_Name $Column$Row:$Column$Row"
3. Save Changes.
4. Close File.
My apologies but I have very little experience in writing VBA. I understand about variables, arguments, and IF/THEN but just enough to use functions within Excel.
I have a range of data that will grow as the days of the month pass but I need to run calculations on this range. The data is 13 columns wide but the number of rows will increase daily. I remember using a formula in the Define Range that would automatically take into account new additions using the OFFSET function but cannot for the life of me think how exactly to do it.
View 4 Replies View RelatedLine of code that will Select a Named Range in this case I have Named a CELL "DataSummary" Need to use that named range by selecting 30 columns and 54 rows.
Range("DataSummary),(??,??) doesn't work.
I have been working on part of the code for my spreadsheet and it works fine in the spreadsheet “Databaseform” however when I copied the code to my master spreadsheet “Paul_PartLocDBCombo” it does not work, I get the error:
Method ‘ range’ of object ‘_worksheet’ failed
The code is then highlighted in yellow, the code is:
Set rng = wksPartsData.Range("a1", Range("a65536").End(xlUp))
Meaning this part is incorrect but I don’t know why? To work it: go to Databaseform and press start. Enter 7mm in the product field and press find all. It will then return all the matching results in the userform. Its this I want to try and achieve on the other spreadsheet when the button find label is pressed.
i need to take all cells in column A with values and all cells in column B with values and combine them into column C so i can sort and subtotal. Columns A and B may have 2 values or 2000 values.
View 10 Replies View RelatedHi, I have this good working formula: ...
View 6 Replies View RelatedI have searched for this on the site as I thought it would have already been asked but I couldn't find anything. I have a formula in cell C7 which I wish to copy both down to the last row (xlup from column A) and across to the last column (xltoleft on row 6) but I cant seem to work out how to do it. I have used the .autofill before but for dynamic rows only. Is it possible to do for columns too?
View 2 Replies View RelatedTrying to create a dynamic vba code that searches the second last active column for a particular criteria. In this case it is the value "901".
If the criteria is met it will search the row to see if value is >=0 then change to zero where applicable.
In the example, I have a loop which searches Column 6 for the matching criteria. I want to change from Column 6 to "second last column" which is Dynamic to allow for more column to search through.
The two codes below search through column "A" and Column "B". Is there anyway to make this Dynamic also so it searches from Column "A" to the 4th Last Active Column.
So the Column to check for Matching Criteria is "Second Last Column" The Data to Loop through will be from Column A to the "Fourth Last Active Column".
Public Sub ChangeCellValue_TwoConditions_ColA()
Dim Last_Row As Long
Dim iLoop As Long
Last_Row = ActiveSheet.Range("A65536").End(xlUp).Row + 1
For iLoop = Last_Row To 1 Step -1
If (trim(ActiveSheet.Cells(iLoop, 1).Value) >= 0) And (trim(ActiveSheet.Cells(iLoop, 6).Value) = "901") Then
ActiveSheet.Cells(iLoop, 1).Value = "0"
[code].....
I regularly get a sheet that contains about 20 columns. I need to delete about 14 of them, and re-order the columns to a fixed order.
The columns always have the same headers, but are ofter in different positions (so I cannot hardcode the column location).
I have tried using the following, but fail on trying to use the result of the find in the selection afterwards.
I also do not know how to loop this through a list of column names (as I said, the input always has the same column names, and I always have to delete the same columns, and sort the remaining).
Sub Sort_My_Columns()
Cells.Find(What:="name1", After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=False).Activate
myRow = ActiveCell.Row
MyCol = ActiveCell.Column
Columns("myRow:myRow").Select
Selection.Cut
Columns("A:A").Select
Selection.Insert Shift:=xlToRight
Range("A1").Select
End Sub
I've searched and tried some similar examples but cannot find a fit that works. I have two columns of data on the same worksheet- IO2 & IR2 (3 columns apart) that will have varying end lengths. I need to combine these into one column on a different tab ( cell A8)- one on top of the other. When it gets to the first blank cell I want it to stop and grab the second column till it gets to the first blank cell. Note-these columns need to stay in the current order but format will not matter. It sounds so simple but I cannot make a formula or macro do what I need it to. I would prefer a macro because the workbook is already so slow.
There is a second part too (but I couldn't even get past the first!). Once the above is done. I will actually have the process repeat and return two different columns next to each other. I then want to reference these two columns and a month and find the correlating set of date in the first worksheet and bring it over. Here is the current macro I was trying (for part 1) but I can only get 1 column returned.
Sub FCST()
Dim improw As Long, impColumn As Long, MyCell
Dim ws1 As Worksheet, ws2 As Worksheet
Dim improw2 As Long, impcolumn2 As Long
Application. ScreenUpdating = False
Set ws1 = ActiveWorkbook.Sheets("Marketing")
Set ws2 = ActiveWorkbook.Sheets(" Forecast")
improw2 = 8
impcolumn2 = 1
impColumn = 249
Do Until impColumn = 252
improw = 2
Do Until improw = 11078 'this is the number of possible entries in each column.........................
I have a list of several hundred columns, beginning with column "G:G", with varying numbers of rows of data in column - each row dipicting a monthly data point. I'd like to average the numbers in each column (need to average over the appropraite time-frame) and compare that average with the corresponding average (same time-frame) for benchmark (column"F:F"). The problem is I don't have the same number of data points in each column; some have data points for every month for the past 33 years, and some just a few years; almost all have differing beginning and ending dates as well.
[Code] ....
I have a 6000+ row database with 5 columns across. The 5 columns have the following headings: Hair Color, Eye Color, Age, Location, and Salary.
I have created macros that will filter each column based on criteria - for example:
[Code].....
As you can see, at cell J10 and K10, I list the filter that is used for a particular search. Some searches, will only have 2 search criteria, some may have all 5, etc.
On a separate worksheet (in the workbook), I have a "Report Tab", my question (after a long build up) is how do I dynamically change the columns and values on the "Report" tab depending on the search that I perform? For example, if I did a two variable filter (Hair and Salary), those would be the only two columns on the report - if I did all five variables for the search, all columns would be on the report, and so on.
I have been trying the whole day to create a formula to solve this but I just can't get it. To make it simple, let's say I have column A filled with different people names, column B filled with Level of Complexity and column C with the Activity (work task) title. This table is fed dynamically, so the number of rows can vary from 2 to 2000.
What I want to do is count how many times a single name appears related to the same complexity, so I can tell how many "simple, medium or complex" tasks each person has in their work queue.
A simple table example would be:
colA colB colC
Dan Complex Build House
Dan Complex Build Shopping center
Dan Simple Take dog to walk
Jose Simple Clean desk
Maria Medium Paint office roof
Then, on another cell I'd like to have a formula automatically telling me that Dan has 2 Complex tasks and 1 Simple, and so on - considering number rows is not a fixed number. What I have so far is this: =SUMPRODUCT((Data!$I$2:$I$457="Dan")*(Data!$L$2:$L$457="Complex"))
But I need to tell a specific last row, and if the data worksheet gets updated with less data (say 450 rows) the formula breaks...
I have a problem as I need to present data with different data sources. I'd like the calculations to be as "automatic" as possible. The data consists of countries and regions and their sales pipe. The pivot table doesn't give me all the data that I need to present so I need to add extra columns with calculations and data from other data sources.
The problem I meet is that the 'total row' within each group needs to be reflected in my columns as well (F:G) It works as long as the data I've imported has the same amount of States within each group of Contry but if the number of states differs with the newly imported data - my "manual" columns are wrong.
(A;B;C;D;E;F;G;H)
Country;State; Red; Amber; Green; Quota; Total PV; Coverage;
I've created a Pivot table on the first 5 columns [Country; ...; Risk] (A:E)
The following columns are manually entered based on the pivot (F:H)
Quota (data source from another sheet)
Total PV (a sum of Red; Amber; Green in the Pivot)
Coverage (returns % of TotalPV/Quota)
For each group Quota and Total PV needs to summarize the above data within the group. I've 'hard coded it' today (SUM(F3:F5)) - F3:F5 can as well be F3:F8 or F3:F4 depending on the imported data. I have 8 different Countries (groups) with different amounts of States and 3 different sheets for each Region of countries so I need this summary to be automatic based on what group (Country) it belongs to. How can I make the calculation different so that it's dynamic as well as the Pivot table? Today it's not dynamic and it needs my 'hands on'.
Quota =IF(ISNUMBER(SEARCH("total";A6)); SUM(F3:F5); IF(ISNA(VLOOKUP(B6;Quota!B:F;3; FALSE));" ";
IF(VLOOKUP(B6;Quota!B:F;3; FALSE)=0; " ";(VLOOKUP(B6;Quota!B:F;3; FALSE))))).
I have this macro named ABC to bring the name ranges to another worksheet. The name ranges are already saved in the workbook with the below name range. I used "***" so that this formular can go to the last cell that has "***" on A column and it worked untill someone typed "(xxx)" and the range now stops right before the "(xxx)"
=OFFSET(Storage_Team2!$A$1,0,0,MATCH("***",Storage_Team2!$A:$A,-1),37)
What would be the best to create the range according to the specific words in a column?
i am coloring cells:
Sheets("MySheet").Range("a1:f200").Interior.ColorIndex = 5
i want a dynamic range, so something that would look like this as an excel function:
=OFFSET('MySheet'!$A$1,0,0, COUNTA('MySheet'!$A:$A),6)
i want the equivalent of this programmed (hard coded) into vba
i don't want to reference to a defined name with vba, because the user can delete that.
I wonder if there is a way to Sum the total of a Dynamic Range so that the summary will be presented in the upper Cell of the summed column?
(please see the attached picture).
The reason is to anable FREEZING of the first row (display the totals all the time even when scrolling down) as the list will get very long after a while.
I am looking to sum a dynamic range and can't quite figure it out. The data expands down rows every week, and I want the sum formula (the final row) at the bottom to include the newly updated rows. I can't dynamically name the numbers to be summed because the dynamic named range will include the sum number and create a circular reference. For example:
5
4
3
2
14
the bottom row (14) is the sum. Next week, my numbers are
5
4
3
2
5
19
I have a macro that will automatically put the sum formula in the correct row and column, but can't quite figure out the formula.
I am currently recorded a macros for a sumif formula. But since the number of rows will not be same every time.
I want the code for a dynamic range.
VB:
Range("E7").Select
ActiveCell.FormulaR1C1 = _
"=SUMIF('V1 Pivot'!R5C2:R32C2,'Task Level Tab'!R7C2:R30C2,'V1 Pivot'!R5C3:R32C3)"
Range("E7").Select
[Code] ....
I need the code for formatting to be edited, so that it work dynamically for any range
VB:
Range("B16:L16").Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
Selection.Borders(xlEdgeLeft).LineStyle = xlNone
With Selection.Borders(xlEdgeTop)
[Code] .....
Here the columns "B" and "L" shall be constant, but the number 16 may vary depending upon the number of lines in the sheet.