Vba Dynamic Column With Start & End Parameters
Nov 18, 2009
I have a sheet of data from a SQL server in Sheet1 that will be updated periodically. The data is basically structured in a date (column A), and value (column B) format.
I'm trying to create some graph functionality so that it would be possible to graph desired ranges of the data by only entering start and end dates.
That is, in Sheet 2, I enter, say, 12/31/1990 in A1, and 12/10/2006, in A2, and a column is created in SHEET3 that represents this data. The request is similar to 'datebetween' in a pivot table. It would be ok if the data created is a pivot table, however, I've struggled to find a way to do this. It seems that any range you name cannot use variables.
If this question is misleading, I'm trying to use the code
Sheet2.Range("A1:A10").CopySheet1.Range("A2")
However, I want "A1:A10" to be variables. Something like:
Sheet1.Range("Range("F6").Value:Range("F9").Value").Copy Sheet2.Range("A2")***Note: this doesn't work b/c of range object.
View 9 Replies
ADVERTISEMENT
Apr 9, 2014
I am using the below code to sum from "L2" to LastRow2
Code:
LastRow2 = ActiveSheet.Range("L6500").End(xlUp).row
LastRow3 = ActiveSheet.Range("L6500").End(xlUp).End(xlUp).row
Cells(LastRow2 + 3, 16).Formula = "=SUM(L2:L" & LastRow2 & ")"
How can I replace “L2” with “LastRow3” which is a dynamic starting point for the range sum?
View 5 Replies
View Related
Aug 28, 2013
We're making a dynamic chart based (picture below) on test scores from neuropsychological tests ("IQ tests"). The chart displays median, min and max scores of several tests that are clustered on the X-axis into 9 domains (each containing several tests). The Y-axis display the results in T-scores ("T-Skarer") (kind of percentile rank). The chart is dynamic. If a person only have scores around the T=50 (50th percentile), the Y-axis adapts to this (no fixed values). But what we need in addition to the T-scores on the Y-axis are z-scores (standard deviations).
My question: Is it possible to incorporate an additional dynamic Y-axis with standard deviation (next to the T-score columns)? (the z-scores are eqvivalent to percentiles, but have different values.
View 1 Replies
View Related
Jul 13, 2007
I would like to create a dynamic range of numeric type in a single column. Only the precise position of one middle cell is known, let's say $A$20, but the range is supposed to extend above and below $A$20 and to finally include all adjunctive, positive and negative numbers in that very column.
Having read the ozgrid-resources on dynamic ranges let me experiment with the following line, however, it seems to include all entries in the column disregarding the format type or the fact that they should all be adjunctive (meaning that wherever there's a text entry it should be seen as the natural end of it): ....
View 7 Replies
View Related
Nov 12, 2009
I have a SUMIFS function written that reads where some of my budget is coming from. I track several different departments but am only responsible for some of the departments' budgets. So i need to exclude two of the departments when the SUMIFS is reading the other parameters from my list.
From the example i attached, how would i go about writing the formula in I3 to skip the Cost if it comes from Dep 2 and Dep 4?
View 3 Replies
View Related
Nov 17, 2009
Is it possible to set parameters on a query but use a wildcard to return all instances? I have a query that I want to be able to set multiple parameters on but give the user the ability to select as many or as few parameters as they want to see. 2 of the parameters are number fields and 2 are text fields with no spaces.
View 4 Replies
View Related
May 3, 2013
I have a pivot that includes customer data and I need to create an average for each row based on the first populated column for each customer. After one month of units appears for the customer, I need to calculate the average going forward, and if there are blanks after that they should be treated as 0 in the average. Below is an example of my description of the pivot.
Jan Feb Mar Apr
Customer #1 1 1 3
Customer #2 1 3
Customer #3 2 2
So, the average for customer #1 would be calculated from Column B to Column E, and factor column D as a 0 in that calculation. Customer 2's average would start in Column C and go to Column E, and factor column E as a 0 in that calculation. Customer 3's average would start in column D to column E.
View 5 Replies
View Related
Feb 13, 2014
I have a column that is listing steps in multiple processes. I have each step 1 marked with a number 1 and would like to have a macro run that will read the column and when it sees a 1 move down to the next row and insert a 2, 3, 4, etc. until it hits the next 1 and then repeat the process. I am unsure how to build this as I am just starting to learn some VERY basic VB scripting.
View 5 Replies
View Related
Jun 16, 2007
I have been trying to see if I can peform the following, I want to be able to have Day 1 (Col B) by using the Start and Finisg Columns Place a 1 in column H for every hour between the Start and Finish times.
This needs to be done for each of the Day in column B, ie 7 Days.
Coulmn's FGH is repeated for the 7 days....
View 9 Replies
View Related
May 26, 2014
In my attachment I am trying to identify rows within Table 2 that do not fit in with Table 1. For example in Table 2, Row 16 has a Start Date of 17.11.2010 and an End Date of 13.11.2011 for ID number 151. This record has to be shown as "OK" because it fits into the date range of Row 103 of Table 1 i.e. Table 1 Row 103 has a Start Date of 01.01.2010 and an End Date of 28.02.2013 for ID 15. In other words the Start Date of Table 2 Row 16 is GE the Start date of Table 1 Row 103, and the End Date of Table 2 Row 16 is LE the End Date of the same Row 103 of Table 1, therefore this reocrd is OK.
Row 14 of Table 2 needs to be shown as "NOT OK" because it has a Start Date of 12.01.2013 and an End Date of 31.03.2013 for ID 15 and this doesn't fit any date range of any Row in Table 1 for ID 15.
View 2 Replies
View Related
Dec 27, 2008
Of course you can make a Range like this
View 3 Replies
View Related
May 24, 2013
Want to type in a formula and copy it down through the column.
The formula should find the most recent final for the country listed in column A.
Country
Champions league final
Formula (Most recent final - country)
Spain
2012
?
[Code] ........
View 2 Replies
View Related
Dec 9, 2005
I have a column of figures and a formula that displays the sum. My issue is that I occassionally insert more rows with more figures but obviously the sum doesn't include this new figure as the range is static. I guess I'm looking for a way to dynamically perform sums in a column.
View 5 Replies
View Related
May 1, 2006
I'm trying to use the Sumif formula when the "Sum_range" parameter is dynamic. I can identify the column number (by using "match" formula) but I have no idea how to use this information as a parameter in my SUMIF.
View 2 Replies
View Related
Nov 13, 2008
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 Related
Apr 8, 2013
I need a Text to Column VBA code that will find a dynamic range. Example: I will be sorting range B1:X20. After it has been sorted, I need a VBA Text to Columns code to be applied to dynamic range H1:H20. I can write VBA language that will identify H1 as Range1 and H20 as Range2. How do I get the VBA to identify Range1:Range2 for Text to Column to be applied? Can "Dim" languace assist in locating the dynamic range?
View 5 Replies
View Related
Nov 3, 2008
I'm trying to define a dynamic column range call 'Cost'
If it starts in Column C, row 4 [C4]. I want the range that to go down to the Row I have defined as 'subtotal'
The user will be able to insert new rows above 'subtotal'
How can I define Column C4 so that any new row added will be including in the defined row range 'Cost'?
View 9 Replies
View Related
Apr 24, 2007
I have a huge database. The rows are broken up by the groups. The columns are broken up by months, quarters, and totals. All the named ranges are the same exact size because all groups have the same category names and all columns have the same amount of months and quarter columns. So it sort of looks like this
Actual 2006-----------------------------Actual 2007
Group Category Jan Feb Q1 Total-------Group Category Jan Feb Q1 Total
100 Labor Cost 220 130
100 Labor Cost-Expense
Group Category Jan Feb Q1 Total
101 Labor Cost
101 Labor Cost-Expense
Hopefully this gives you a good idea of what the spredsheet format is. Right now I have named ranges for all the groups and years. So the top left name is A06_100, then it goes A06_101, etc. What I'm trying to do is set this up as easy as possible to insert rows in the named ranges and keep the named range, because they are referenced a lot in other worksheets. Also if any columns get added. Basically I want it as user friendly as possible so when people change things it stays together.
View 2 Replies
View Related
Jun 29, 2007
My spreadsheet has in the region of 30 columns, more will be added on occasion in the future and ultimately I want to have each of the column headers appear in a 2-tiered dependent combo box. In the following structure:
Category 1:
Header 1
Header 2
Header 3
Category 2:
Header 4
Header 5
Header 6
Header 7 etc...
What I'm not sure about is what the most efficent way of making it so that it will automatically add new Column headers (and possibly categories) to the drop-down box so that it does not need to be re-coded in the future.
View 8 Replies
View Related
Apr 15, 2008
I need to create a validated list of month choices, and the list needs to be filled with the names (Month and year, I.E. Feb-07) of the last 13 months for which we have data.
(We get our data about 8 weeks late, so being that it is mid april now I only have data now up to the end of Feb-08. I have created a chart in which the viewer can change the month to view but up to now it has only been for the current year, now they want to see the past 13 months, obviously I don't want to go in and change this every time the next months' data is entered.
So, what offset formula do I use to reference the month-year names which are spread across Row 1, presently in columns C thru N, and the next months data (March) will go in column O, then April's in column, P, etc
I have tried several variations of this; =OFFSET(C1,0,0,0, COUNTA($1:$!)) but how do I get only the last 13 months?
View 3 Replies
View Related
Mar 14, 2014
I am trying to add a 0 if it is missing at the start of the number in columns K2:K3000 and L2:L3000, The numbers do not have fixed lengths so I cant use the custom setting but if the number starts with a 7, 8 or 3 I want to add a 0
View 6 Replies
View Related
Jun 21, 2013
I'm trying to calculate a figure in a report tab that reads off the data tab and looks for a specific column based on the header of that column. My explanation is admittedly poor but I've attached a sample file with an outline of what I'm trying to do which I hope makes things clearer.
Sample File.xlsx
View 2 Replies
View Related
Aug 4, 2014
I'm using a table with dynamic data to populate a column/line chart.
The data is based on monthly targets achieved and forecasted. With each month, the information will update. The graph needs to have only the current month and future months to be displayed and I don't want to include the previous months information in the chart. The information in the chart automatically updates and loses the previous month's data. Unfortunately, the graph plots the blank data and has a blank entry on the graph. This means that the information I need starts in the middle of the chart and has a line that shoots up from 0 to the current month's value.
Is there any way that I can omit the month altogether?
The data source I am using is below:
MonthTarget for month* (examples)
October 100,123,669
November 125,154,586
December 150,185,503
January 175,216,420
February 200,247,337
March 225,278,254
April 250,309,171
May 275,340,089
June 300,371,006
As you can see, July August and September are not included. I want to be able to start the graph from October in the above example. In the following month, I want to use the same data but October Figures will not be required. How can I achieve this?
View 9 Replies
View Related
Jun 18, 2014
I am attempting to create a form in excel with dynamic data validation fields. What has me stumped is that I want to create multiple complex dependencies (for instance, if you select something from a drop-down list in the first field, that then gives you a specific range in the second field. Then based on what you placed in the second field it gives you a specific range in the third field.). What I can't seem to work out is the formula for making this work.
Is this impossible? Also sometimes the third field my be blank.
Here is an example of what I am trying to accomplish
Assets 2.PNG
View 1 Replies
View Related
Jan 15, 2014
I have a two way data table for which the two variables are changed frequently. In the data table, for ease of reference, i usually highlight the corresponding row and column of the two most current variables the intersection of which gives you the current output. But these highlights need to eb changed each time the variables are changed 9the table is copied onto another document for presentation hence the need to keep changing the highlights).
I was thinking of configuring the highlighting process to happen dynamically, i.e. the row and column highlights change dynamically when the variables are changed.
View 7 Replies
View Related
Aug 13, 2009
I was wondering if there was a way to create a two cell dynamic range that doesn't expand, but instead shifts.
The cells that I'm interested in are always at the bottom of the column of data. For example, the first two cells I want as my range are C13 and D13. Then, for my next use of the range, I would like it to include C14 and D14.
View 11 Replies
View Related
Dec 9, 2011
Looking for a dynamic macro to reorder columns in a worksheet from a list of column headings Column A in another worksheet.
View 3 Replies
View Related
Feb 6, 2012
Every thread I see on Google search for creating check boxes on a user form based on worksheet data says to use a list box, but I really want check boxes. Any code that will create, on initialize of the user form, a check box for each item in Import!B2:B (last row), regardless of the number of items? I am only worried about having about 20 max. Usually, it will only be 5 to 10.
I did try the list box, but it doesn't populate the list box.
Code:
Private Sub UserForm2_Initialize()
Dim lbtarget As MSForms.ListBox
Dim rngSource As Range
'Set reference to the range of data to be filled
[Code] ..........
View 5 Replies
View Related
Nov 2, 2013
I have a column with random values that are generated my my machinery.I should not sort them, because they provide me with the performance graph. Lets say i have column "A"
0
2
9
9.5
30
90
22
15
9
0
As the max value of this is 90, and its 10% of MAX is 9, which occurs at 3rd and 9 th positions.I need to find the average of its adjacent range, with zeros not considered.It has to calculate the max value in the column, find 10% of max and do average of adjacent column from the sl. no of first occurrence of 10% value in first column to the sl no of last occurrence of 10% value in first column.
the exact 10% value may not always exist. 10% of 90 is 9, but if the max value is 94, the 10% would be 9.4 which doesn't exist. then it has to take the nearest available predecessor in that case.i get values in decimals mostly and only some of them are perfect integers, thus this consideration goes with it,and also, my range actually is B14:B10013
i would most probably have the 10% value within the first 50 "non zero" entries and reoccurring somewhere probably within the last 50 "non zero" entries.
View 7 Replies
View Related
Jan 29, 2014
I'm trying to pull information in one spreadsheet (SS1) from another spreadsheet (SS2). I've found that the following works, except when SS2 is closed. Is there a way to do the following formula so that it will work even if SS2 is closed?
=VLOOKUP(A19,A:H,MATCH("Column Header",OFFSET(1:1,MATCH("Row Header",A:A,0)-1,0),FALSE),FALSE)
Link A19 is the lookup value
"Column Header" is the column header we want to find
"Row Header" is the unique row header for the headers of the table
The Column Header could appear anywhere in Column A to H, and the Row Header can appear on any row in the spreadsheet!
View 3 Replies
View Related