Append Variable Based On Date Ranges?

Oct 10, 2013

I have a reference dataset that looks like:

Adweek Start_Date End_Date
201201 05-Jan-12 11-Jan-12
201202 12-Jan-12 18-Jan-12
...

In the dataset I would like to merge the variabe Adweek, looks like:
Date Sales
05-Jan-12 $100
06-Jan-12 $110
...
15-Jan-12 $150
...

I'd like to get to here:

Date Sales Adweek
05-Jan-12 $100 201201
06-Jan-12 $110 201201
...
15-Jan-12 $150 201202
...

View 2 Replies


ADVERTISEMENT

Append Date Variable To Header/footer

Dec 4, 2007

I'm trying to append a date variable to the end of headers for let's say 3 worksheets in a workbook. Each worksheet has a different string value, and I want to add a date variable at the end.

For example, sheet1, sheet2, and sheet3 says "Country Analysis", "Regional Analysis", and "State Analysis", respectively. I want to add the month and date to that so it would say something like "Country Analysis December 2007" for Sheet1, without hard coding it. Essentially, loop through however many worksheets and add a date variable at the end of each header on the left side.

I know how to get the date variable (format(date, "MMMM YYYY")) and the code behind the headers.

View 9 Replies View Related

Append Variable In Variable Select Case Method

Feb 16, 2012

I want the select case list of a ComboBox to be treated as a variable in order to shorten the code size. To clarify the problem, i post the code with what i want to do, but don't know how to do it that way.

Code:

Select Case ComboBox1.ListIndex
Case 0: y = "AT"
For j = 0 To 26
Case "j": y = sheets("name").Range("A(j)") 'Range A(j) is a string, so y as well, as seen in Case 0.
Next j
End Select

Is something like this possible?

View 3 Replies View Related

Summing Amounts Corresponding To Variable Date Ranges

Oct 25, 2007

Need formula which can sum Amounts from varying Weekly time periods and the result be recorded in the appropriate month? I've attached a simple example of the way the output needs to look and a sample data table below.

View 3 Replies View Related

Updating Values In Variable Ranges Based On Repeating Patterns In A Column

Jul 6, 2006

I have a list of two columns. Here’s an example. The left most column provides the row number.

_ A B
1 1 0
2 2 1
3 2 1
4 3 2
5 4 2.5
6 5 4
7 1 0
8 1 0
9 2 2

Whenever there are two repeating numbers in column one, I want to reduce certain numbers in column 2 by a certain amount. The amount is determined by half the difference between the number in column B corresponding to the second repeated number and the number in column B corresponding to the row after the second repeating number. The range of numbers that are to be reduced begins with the row after the second repeating number and ends with the last row before number one appears in column A. The values in column A are integers, always starting with one. For example, 1, 2, 3, 4, 1, 2, 3, 1, 2, 3, 4, 5.

For the above example, after finding the repeating number two’s at A2 and A3, it would reduce B4 through B6 by half the difference between B3 and B4 (1/2). The values for B4 through B6 would be updated in column B. The same for the next repeated numbers, which is one at A7 and A8. Half the difference between B8 and B9 is 1.

Here’s what the updated list would look like:

1 1 0
2 2 1
3 2 1
4 3 1.5
5 4 2
6 5 3.5
7 1 0
8 1 0
9 2 1

View 9 Replies View Related

Append Numeric Portion Of String To Variable

Aug 18, 2007

How would I be able to assign a number portion of a variable string to another string variable. For example I have the following string:

AOSXLS_356-NewInfo

I just want the 356 assigned to a string variable.

only the first 7 characters won't change. The number part could be 2 or 4 digits, and the NewInfo portion could be anything.

View 3 Replies View Related

Sum Based On Date Ranges?

Dec 13, 2012

Sum based on date ranges. I am creating one logical formula.

I have an excel sheet with two columns.

A1: Date B1: Time Spent

Date
Time spent (in Minutes)
Total

[Code].....

As per above figure I want to sum based on the same dates. I.e A2 has date 1/26/2012 for which first entry is 12 so total will say 12 in C1, for the same date second entry is 14 so 12+14=26 is there in total at C2, for the third and last entry of 1/26/2012 it's 16 so total would be 12+14+16 = 42 in C3 which is grand total for 1/26/2012. I want to fill entire C column with some logical formula so that the logic holds true for various dates.

I have tried to use the IF formula like =IF(A1=A2,SUM(B1:B2)) but it fails at third cell. I have tried several ways to do this but no luck so far ....

View 2 Replies View Related

Filling In Cells Based On Date Ranges

Aug 20, 2008

I have the following:

A/B/C/D/E/F/G/H/I/J/K
April 2008 / August 2008/Jan/Feb/Mar/Apr/May/Jun/Jul/Aug/Sept/Oct....

How can I get excel to fill in a constant number say '3' automatically based on the date range in column A and B. For example, in this case Since the date range is from April to August how can I get excel to automatically fill in 3 for apr/may/jun/jul/aug

View 9 Replies View Related

Summing Values Based On Date Ranges

Nov 6, 2008

summing monthly values based on different date ranges. For example if I have multiple contracts with different start and end dates and based on those date ranges, I want to sum the respective monthly production totals, how would I do that in a formula. I started to set up the table to include "start date month" and "# of months in contract". Is there a way to sum based on the start month and # of months in contract.

For example if hte contract started in Jan08 and ends in May08, the calculation would start with month "1" and sum over 4 months.

Here is an example: ....

View 9 Replies View Related

Selecting Between Two Date Ranges (based On Days In Month)

Jul 8, 2014

I have a list of data that displays data by day, I want to select only the data for the for the current month and then the same day time frame for previous months in the data set.

E.g.

Today's date 08/07
Full days into month 7

Formula to sum data in columns B that only looks at dates 01/07-07/7

I will the adjust that formula for a January date that only pulls data for 01/01-01/07

Then repeat for Feb-June

View 3 Replies View Related

Macro - How To Group Data Based On Date Ranges

Oct 3, 2012

I starting to develop a macro for grouping specific information together. part of it I need to group data based on date ranges. My plan was to, in one sheet label the start and end ranges by month (not every range starts and stops at the beginning and end of the month)

For July I would have 7/1/2012 in one cell and in another 7/28/2012
For august I would have 7/29/2012 next to it 8/25/2012, etc

I need to take those ranges and in my FY2013 sheet column I where all of my dates are listed, in the next column J if the date says 7/1/2012 to label it July, if date says 7/30/2012 to label it August, etc.

View 1 Replies View Related

AVERAGE IF Statement Based On Matching Condition And Date Ranges

Feb 22, 2009

I have created a spreadsheet which creates an average of feedback for trainers in a training company. The form adds up the feedback score into column L of the summary sheet and I have created a summary sheet which I want you use to calculate the average for each trainer.

I have cobbled together an array formula which creates the overallaverage for each trainer based on the named ranges entered via the form.

It looks something like this:

View 10 Replies View Related

Auto Populate Excel Calendar Based On Date Ranges

Dec 4, 2013

I am trying to have the calendar in the second tab of the attached excel file to auto populate based on info in the first tab.

In the first tab, there is the start and end dates of certain projects. The calendar will need to only show the project name of every project being worked on that specific day.

Some days will have more than one project being worked on, the Calendar will just need to list them all under that day. The Start and End dates count as days the project being worked on as well. We will also need the calendar to auto update whenever we modify the dates in the first tab or add/remove projects (rows).

View 5 Replies View Related

Hide / Unhide Rows And Columns Based On Several Date Ranges

Mar 19, 2014

I am building a sheet to display deadlines (rows) by project (columns). I would like to have it automatically hide the rows and columns based on the date of the deadline. If the deadline is today or 1 week from today the associated rows and columns should be visible, otherwise, I would like to hide them.

My table is A1:N9, with A1 being a blank, row names A2:A9, and column names B1:N1.

View 4 Replies View Related

Formula To Identify Week Number Based On Date Ranges And Add Values

Feb 18, 2014

I have the following data:

Column A = Date
Column B = Reservations made per day

For ex:

A B
1 3/1/2011 5
2 4/5/2011 10
3 3/8/2011 15

Then I have a look up table where based on the date ranges it assigns a week number.

WeekDATE Range 1Date Range 2
718-Feb-1124-Feb-11
825-Feb-1103-Mar-11
904-Mar-1110-Mar-11
1011-Mar-1117-Mar-11
1118-Mar-1124-Mar-11
1225-Mar-1131-Mar-11
1301-Apr-1107-Apr-11
1408-Apr-1114-Apr-11
1515-Apr-1121-Apr-11
1622-Apr-1128-Apr-11

I am looking for a fomula that would assign a week to the corresponding dates on column A and tha would then add all of the reservations booked for each week.

View 11 Replies View Related

Creating Autofilter That Returns Records Based On Date Variable

Mar 13, 2013

I have a strange problem I cannot solve in that I'm trying to create an auto filter that returns records based on a date variable.

If I set the code to equal the date variable, it returns information. If I set the code to return records AFTER the date, it returns nothing.

Code to return records on the date:

Dim startdate As Date
startdate = Format((Now), "dd/mm/yyyy")
ActiveSheet.Range("A:B").AutoFilter Field:=2, Criteria1:="=" & startdate

This returns data, however if I slightly amend it to get records on or after the date:

Code:
Dim startdate As Date
startdate = Format((Now), "dd/mm/yyyy")
ActiveSheet.Range("A:B").AutoFilter Field:=2, Criteria1:=">=" & startdate

It returns nothing. Is there a syntax problem in my code.

View 1 Replies View Related

SaveAs Current Date & Append With Number

Sep 19, 2007

I have saved an Excel file based on today’s date using: ActiveWorkbook.SaveAs "S:MTL_DATA Stock Orders" & "Stock_Order_" & oname & Format(Date, "dd-mm-yy") & ".xls"

If I wish to save a second file in the same day I wish to save as the date with “_1” or date with “_2” for the third file etc. How do I alter the above code?

View 4 Replies View Related

Append Current Date To Active Workbook Name

Mar 3, 2008

I want to save my active workbook with the current name together with the date Auto Merged Post Until 24 Hrs Passes;Sorry, new to this.

View 2 Replies View Related

Create Workbooks From Sheets & Append Current Date To Saved Names

Apr 22, 2008

I have a workbook with multiple worksheets. First 4 tabs are the standard tabs and rest of the tabs are created based ona macro with the unique names. Now i want to create the separate workbook for each tab by its name and , date and time stamp in a C directory.

View 5 Replies View Related

Copy Based On Column Criteria & Append To Another Sheet

Jan 18, 2008

I have a spreadsheet that is used to store statistical information on a monthly basis, some of this information may be incomplete and so will need to be acted upon month by month, What I need to do using VBA is: At the close of the spreadsheet check sheet1 and if there is any data (text) in cells N – Q on any line If there is move to sheet3 check for the next blank line then paste the data from only certain fields i.e. A,B, N-Q,R,S

Here is another problem

As the sheet will be used on and off during the month I don’t want data that is already been moved across to sheet3 to be copied again so there needs to be someway of checking if the info is already there? I have code now for the find last cell part of the problem.

Sub FindLastCell()
Dim LastCell As Range
With ActiveSheet
Set LastCell = .Cells(.Rows.Count, "A").End(xlUp)
If IsEmpty(LastCell) Then
'do nothing
Else
Set LastCell = LastCell.Offset(1, 0)
End If
End With
LastCell.Select
End Sub

View 9 Replies View Related

Automatically Copy & Append Range To Another Sheet Based On Number Entered

Mar 15, 2008

I need help with creating a macro that runs when a user enters a value in the 'Numbers' column, copies and pastes data in the corresponding worksheet 'Worksheet' column by the value of 'Numbers' column data. An excel file is attached.

View 6 Replies View Related

Move Ranges To Corresponding Ranges Based On Column Having Data

Oct 25, 2007

I need help creating a macro that will search through my excel spreadsheet and for every instance where column A isn't empty it should cut a range of columns from that row and paste them in a different range of columns in the row before it. It should then delete the row that it cut the columns from and keep searching until it has done this for the whole worksheet. I can modify which range of columns are needed, but it has been so long since I've worked with excel macros that I haven't been able to do it.

View 5 Replies View Related

Date Range: Reference A Single Date And Output Date Ranges

Oct 11, 2008

I need to create formulas that reference a single date and output date ranges. The objective is to have a person input a Monday date in any given month and receive a four weeks out worth of dates and ranges. For example: In a lone cell, the person inputs 10/13/08. Automatically, the sheet produces the next full week range: October 19 – October 25 in a single cell and also produces a cell for each date. Example: Sunday 19, Monday 20, Tuesday 21, etc…. It should look like:

Monday Date:
10/13/08
October 19 – October 25
Sunday 19
Monday 20
Tuesday 21
Wednesday 22
Thursday 23
Friday 24
Saturday 25

and then repeat for three more weeks. I thought I had it figured out until the month changed. The dates continued in October instead of adding a month. This report will be ran weekly, so simply adding a +1MONTH to some cells will not benefit me as I’ll have to change the formula every week. I want the formula to compute the data without any manipulation over the next several years. The only change will be the Monday date.

View 2 Replies View Related

Sum Of Variable Length Ranges?

Jun 20, 2014

So I have got an identifier and a corresponding column of values. I need to calculate sum of those corresponding values for each identifier, so if identifier is 1993, I need to have a sum of all the corresponding values. These identifiers repeat, and I do not want to calculate sum for all of them, just the immediate identifiers (i.e. you have 1993, after that you may have 1994 etc etc and then at one point you will have 1993 again, but that "new" 1993 will have a different sum of course). Also, identifiers do not go in sequence sometimes (however, most of the case they do), for example 1993 may jump suddenly to 2004. The trick with all of this is variable "row width" of these identifiers...

222.xlsm

View 13 Replies View Related

Dynamically Variable Ranges

Dec 31, 2006

In my worksheet cell A1 represents a financial reporting period from 1 to 12. It also represents the number of columns I need to sum in order to arrive at the desired period totals in this income statement worksheet. How can I get Excel to automatically change my SUMPRODUCT function as the value in cell A1 is changed from 1 to 12?

Here is a sample cell formula:

=SUMPRODUCT(ISNUMBER(MATCH(GL1SHL.XLS!$A$2:$A$332, {"4620","5220"},0))*(GL1SHL.XLS!$CE$2:$CE$332)*(GL1SHL.XLS!$I$2:$T$332))

The above formula represents the totals for period 12 for General Ledger accounts 4620 and 5220.

GL1SHL.XLS! references the workbook that has the financial data exported from my G/L application.

$A$2:$A$332 is the column which contains the G/L account number to be matched.

$CE$2:$CE$332 references a cell that resolves to the value 1 or -1 so that expenses which are exported as positive values become negative.

$I$2:$T$332 represents the 12 columns and 332 rows that contain all the financial data necessary to calculate the income for period 12 with each row representing a different G/L account's 12 periods of financial data. I need a method to dynamically replace the 'T' in $I$2:$T$332 and resolve it based on the value in cell A1. So if A1=1 then 'T' becomes 'I' and if A1=2 then 'T' becomes 'J' etc.

I would like to do this as a macro substitution instead of having to make 12 worksheets, one for each period, or instead of having 12 nested loops.

View 12 Replies View Related

Variable Vlookup Ranges

May 8, 2008

I have an Excel File with 2 worksheets.

Sheet1 contains column A as "Product Number", Column B as "Product Family". Rows contain about 20,000 lines of data. A Range has been created to cover both columns, and named "ProdRange"

Sheet2 contains Column A (blank), Column B with "Product Number"

What I am trying to do is start at the top of Sheet 2 "Product Number" (B2 is first cell ref), and use this value to do a Vlookup on Sheet 1, to extract the "Product Family" code on the Offset 1 - and insert it back into Sheet 2 Column A.

I have this below :

For i = 2 To LastRow
Range("A" & i).Value = "=VLookup("B" & i, ProdRange, 2)"
Next i

BUT for some reason it doesn't like the [ "B" & i ] part of the equation.

View 9 Replies View Related

SUM Macro With Variable Ranges

Nov 3, 2006

I cannot seem to get the worksheet function sum to work with varables in this module. It is placing zeros where the summed data should be. The variable are showing proper start and end ranges for summation....

View 5 Replies View Related

Variable Ranges For Find() Macro

Jul 11, 2008

Need to pull data from Sheet4 to sheet1 by Sales Person based on a validation list cell on sheet1.

Each Sales person has a different number of accounts listed on Sheet4. The data is setup like this (my apologies for not knowing how to copy and paste the data)

Will Use Jane Doe and John Smith As examples-

A1, Jane Doe, Customer Name, Data, Data, Data, etc.
A2, Jane Doe, Customer Name, Data, Data, Data, etc.
A3, John Smith, Customer Name, Data, Data, Data, etc.

So Jane Doe has 2 customers total, and John Smith has 1 customer.

I am dealing with a total of 300+ Sales People and over 4,000 customers, all with a different number of customers per sales person.

How in the world can I write a code that will pull all of Jane Doe's customers when she is chosen from the validation list, and paste those customers and their coinciding data where I need it to paste?

I have the validation list working, so all I need at this point is help with the copy/paste code.

View 9 Replies View Related

Variable Cell Ranges In Formulas

Feb 23, 2008

I need to run a formula each month which calculates the ‘product’ for a range of cells in a column, where the cell range will change each month. The starting cell for the range is static, but the range end will always change - additionally, the last valid cell will always be followed by a null value cell. The attached example shows the basic format of my data – a range of values, by row, which will always end with a null value cell. The formula I’m using (to match my example) is: =(PRODUCT(A10:A13) –-> and I want to display the result in cell C10.

While I’ve been able to identify the ‘ending good row’ several ways, I haven’t been able to figure out what to do with this information – I seem be be lost in the translation of OFFSET values to CELL REFERENCE values. Has anyone encountered this specific scenario and found a solution?

View 3 Replies View Related

VBA Code For Printing Variable Print Ranges

May 5, 2009

I am trying to write VBA code that will print a print range that is presented in cell F3 on a "Reports" worksheet. The content of F3 will change depending on how many reports the user selects to print. For example, he could select one, two, three reports etc - up to twelve. The cell ranges of each report are named (e.g. Report1, Report2 etc) so that if the user selects to print Reports 1 and 2, the contents of cell F3 are "Report1,Report2". If I replace WhatToPrint with "Report1,Report2" the print macro works.

Sub Macro2()
Dim WhatToPrint As String
WhatToPrint = Sheets("Reports").Cells(3, 6).Value
'sets the variable to equal the contents of cell D3 which contains the formula
'summarising the print ranges I want to print
Sheets("Reports").Cells(3, 6).Select
ActiveCell.FormulaR1C1 = WhatToPrint
' pastes the variable in cell F3 - just to check that it looks like I want it to
Sheets("Reports").PageSetup.PrintArea = WhatToPrint
'uses the variable to set print area - this is where it fails!
'if you replace the variable with the contents of cell F3 the macro will work
ActiveWindow.SelectedSheets.PrintPreview
End Sub

View 3 Replies View Related







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