Auto Increment Based On ID Variable
Oct 3, 2013
I have a following the following dataset:
ID YearWk Sales
1 201310 $1000
1 201311 $1200
1 201312 $1300
1 201313 $1400
2 201310 $2000
2 201311 $2200
2 201312 $2300
2 201313 $2400
I'm trying to figure out how to create a new variable that will increment and reset based on ID.. similar to the FIRST. function in SAS.
Final Dataset:
ID YearWk Sales Count
1 201310 $1000 1
1 201311 $1200 2
1 201312 $1300 3
1 201313 $1400 4
2 201310 $2000 1
2 201311 $2200 2
2 201312 $2300 3
2 201313 $2400 4
View 3 Replies
ADVERTISEMENT
Nov 20, 2011
In my excel workbook, I have a customer table and invoice sheet among many others.
As part of my system, there is functionality to grant new customers with a discount on the first purchase. Within my customer table, the last two columns are "Number of Purchases" and "Customer Type" (either single/multiple depending on no. of purchases), which are then used to determine whether the discount is valid or not on the invoice.
Once an invoice has been created, archived and refreshed with the customer selected (via a Customer ID), I would like some code to auto increment the number of purchases on the Customer table for that specific customer to +1.
For example, customer called Bob (Bob-1);
Number of purchases = 1
Customer Type = Single
Discount = Yes
Invoice then created for Bob (using Bob-1 as the unique value), sent off and refreshed. New figures should be:
Number of purchases = 2
Customer Type = Multiple (can be achieved by using IF statement on No. of purchases)
Discount = No
View 1 Replies
View Related
Jan 30, 2010
I have been given the following code and it works great. I now need to adapt it to the following scenario: In the attached sheet, the user has to select either, "Suburban" or "Squad" in row 5. If the user selects, "Suburban" I need this script to compare the values they enter in a given row to the value in column "B".
If the user selects, "Squad" I need this script to compare the values they enter in a given row to the value in column "C".
Look at row 48, for example. If the user enters, "Suburban" in cell D5 then the value they enter in cell D48 should equal "1". If it does not equal "1" then it should proceed with the adding of a comment. Conversely, if the user enters, "Squad" in cell D5 then the value the enter in cell D48 should equal "2". If it does not equal "2" then it should proceed with the adding of a comment.
View 5 Replies
View Related
Dec 15, 2006
I am working on a Loop, I have most of it working except incrementing the cell.
I have this,
PartN = Worksheets("Parts").Range("A3").Value
then the loop. what I can't figure out is I need for A3 to increment by one row until the loop is done. i.e. loop runs as A3, then A4, then A5 etc.. until the specified number of the loop is reached (which is basically the number of rows I have)
I tired something like
Dim CellN As Variable
CellN = "A3"
Do Until xxx
PartN = Worksheets("Parts").Range(CellN).Value
then before the Loop statement at the bottom I put
CellN = CellN + 1
but I get a type mismatch error
View 3 Replies
View Related
Jan 16, 2014
If I enter 1 in a cell, 1.1 below, select both and drag down, I should get a vector: 1, 1.1, 1.2 etc.
However, in the most recent instance of seeing this problem, at 6.5 I get 6.50000000000001! 6.6 onwards is then correct, at 7.2 the value is again incorrect in the 14th decimal place, and the errors continue intermittently through the sequence.
Is there a fix for this? It's extremely time consuming to have to check each auto-incremented array like this.
View 4 Replies
View Related
Jun 6, 2014
There is likely an easy fix for this, but I have an auto increment with the following code and would like the letter R to precede the auto increment number everytime.
My current code is this:
Private Sub Workbook_Open()
Sheets("Receipt").Range("F11").Value = Sheets("Receipt").Range("F11").Value + 1
End Sub
View 7 Replies
View Related
Jun 11, 2014
can i link a spin button to a toggle button such that when i click my togglebutton On then the Spin Button causes the Value in a cell to increment from 0.1.2.3.4.5 and when i click the toggle button off then value decrements from 5.4.3.2.1.0
View 2 Replies
View Related
Jul 30, 2013
I have got the following problem. I have got a table which looks like this:
=Time!A1
=Open!A1
=max!A1
=min!A1
=Close!A1
When I mark the selected cells and scroll down using the autofill option I get this:
=Time!A1
=Open!A1
=max!A1
=min!A1
=Close!A1
=Time!A6
=Open!A6
=max!A6
=min!A6
=Close!A6
Why does it give A6? I want A2 instead of A6 because I want to create a table from A1 to A500 but without these jumps from A1 to A6.
View 5 Replies
View Related
Jan 7, 2014
i have excel sheet with name labels.i want count how many times user repated along with his branch code. acctully am done this using this formula, but not getting what am exepected.
Formula in B1 is ="JSK-SW-1"&(countif($A$2:$A2,$A2))
output is value is incremented, but i want text also be change.
A B
Name Count
Sateesh JSK-SW-1
Rajesh Raj- SE-1
Sateesh JSK-SW-2
Rajesh Raj-SE-2
Anil JAK-DE-1
View 1 Replies
View Related
Sep 7, 2006
I am trying to get my invoice sheet to automatically increment the invoice number when I open the workbook. I know it is in the code i.e. private sub? but it doesnt seem to work.
View 3 Replies
View Related
Mar 7, 2014
I have created a simple UserForm to enter new customer details to the Customer List in the spreadsheet, form works fine except for one little thing, which is New Customer ID, which works, but only with numeric values like 1, 2, 3 and so on.
Basically what I need this for to do is once form is opened/called new customer ID need to be created, which could be and Alfa numerical set of characters like AA-01234, AA-01235, AA-01236 and so on.
Also, is there a way of posting newly added Customer ID in the MsgBox along with MsgBox "One record added to Customers List. New Customer ID is "
All of my attempts to create this are failing and causing errors.Here is my code, Customer ID is TextBox1.
[Code]....
View 10 Replies
View Related
Mar 16, 2012
I have made a custom list in Excel 2010 so it auto-increments the alphabet using the auto increment pull down/copy square on the bottom right of a cell in Excel. My question is I have some data in a sheet such as this
600
600
600
600
601
601
601
601
602
602
602
What I want to do is add a letter of the alphabet to the end of these numbers and have the alphabet auto increment based on the data above like this:
600
600A
600B
600C
601
601A
601B
601C
602
602A
602B
I thought it would be simple since I now have a custom list but every formula I try fails.
View 5 Replies
View Related
Jul 31, 2013
I am trying to auto generate a calendar based on two drop down menus - Month and Year.
Once the month and year is selected I want to import all work orders onto the calendar based first on the "Labor Name" found in the list of work tab, then assign each work order for that labor name to the respective date on the calendar for the month.
August PM Schedule Demo.xlsx
View 2 Replies
View Related
Mar 1, 2014
I am working on a model for a school project. Time is in ColA, the number of events is in ColB.
Each event requires one person to work before and after the event. For example, if we assume that I need one person 30 min before the event, one during the event and one 15 min after the event - ColC shows the number of staff required. I would need a formula to calculate ColC. Basically I want excel to add the values of the rows above and below a value if it is within a specified time range
It gets a little bit more complicated unfortunately, the time requirements need to be dynamic - so one day it is 30 min before the event, but another day it could only be 15 min before but 30 min after the event etc.
I was trying to do this with a SUMIF formulas, but couldn't get it to work.
Col A
Col B
Col C
7:00:00 AM
0
1
[Code] .........
View 3 Replies
View Related
May 2, 2012
What I'm trying to do is from a template worksheet that I have in a workbook with other worksheets, I'm trying to come up with code that will create a new worksheet based on the template (copy), increment the invoice number, and rename the worksheet tab to be "Invoice # xxxx" (new invoice number from prev. step.).
I have figured out how to use a button on the template to execute, but as I said my VBA skills are lacking to say the least.
View 9 Replies
View Related
Mar 4, 2008
How would I save a file with the lastest version number after searching for the lastest filename in a folder and adding 1 to the name
ActiveWorkbook.SaveAs FileName:= _
"C:BarkingEMCOUTNOM_DA_" & (Format( Date, ddmmyy)) & "_EDF_BPL_" & V, FileFormat:=xlCSV
where V will be the version number in the format of 001, 002, 003 and so on
View 7 Replies
View Related
May 24, 2008
I'm quite a novice at Excel. I have a column of values that I sum as follows;
A
0
0
0
0
0
0 <----------------sum of A1:A5
A formula may change one of the values in the above column to a '1' which means the sum will become '1'. The sum can only be '1' or '0' and only one value in the column will ever change. I need to add a value of 2 to another cell (say, C1) when the sum of A1:A5 changes from a value of '0' to '1'. I know this will probably involve the worksheet change event but am having a problem implementing it.
View 7 Replies
View Related
Oct 3, 2008
Firstly not really sure if this problem can be solved by a custom formula or if it will require VBA code to resolve it.
I have multiple instances of blocks of cells throughout a worksheet which require a total of that section. Very simple individually (see below) but becomes a nighmare when you need to insert a new row or amend the formulas; which can only be done manually.
A B
1
2 10
3 5
4 10
5 7
6 TOTAL 32
So in this instance the total would be obtained by using sum(B2:B5).
The number of rows in each section to be totalled can vary from 1 row to say 50 rows; however the common factor is that there is always a blank row above the first row of figures.
In essence, I am looking for a single custom formula that can be used anywhere in the worksheet which says:
"Sum all cells in this column, starting with the row above the total, counting upwards and stopping when it reaches a blank (empty) cell"
I know that I can use OFFSET in conjunction with SUM to allow for variable totals when you insert a new row but it still has to have specific column and row references.
I am guessing that this has been asked before but nothing came up when I tried to search the forums for a similar problem.
View 10 Replies
View Related
Mar 11, 2014
Possible to auto count and auto sum based on Unique ID.
Download link to the file in question [URL] ..........
So for Example ID 79125 should get a sum 537.39 and count should be 12, also in any given week like 50 , 51 , 52 , week 1 etc.., duplicate entries must be all counted as 1
View 8 Replies
View Related
Feb 14, 2007
I need each row in the Range("A2:G" & iLastRow) to be formatted with the top and bottom border. I'd prefer to go loopless but if that's not possible I will use the loop.
View 2 Replies
View Related
Feb 25, 2013
How do you drag down a column to auto complete the values but do it so it only changes one variable.For example, I am dragging down =IF(ROW()<=$B$5,MOD(E2*B1,B2),"") down my column.
However, I only want the "E2" value to change, and I want B1 and B2 to stay that way. Whenever I drag down, it keeps changing all three values. Is there a way to make it just so that the E2 value is the only one that changes?
View 4 Replies
View Related
Mar 23, 2009
I RECORDED THIS MACRO BUT I WILL LIKE TO MAKE TO AUTO SELECT THE ACTIVE CELL RANGE IS VARIABLE ON MY REPORTS MY CODE
Sub FORMAT_AS_A_TABLE()
ActiveSheet.ListObjects.Add(xlSrcRange, Range("$A$1:$L$1900"), , xlYes).Name = _
"Table1"
Range("Table1[#All]").Select
ActiveSheet.ListObjects("Table1").TableStyle = "TableStyleDark5"
End Sub
View 3 Replies
View Related
Jun 18, 2009
On my userform I have 20 comment icons (imported pictures), that when clicked need to bring up an InputBox for the user to add a comment, and store that comment in a Public variable specific to that comment which will later be written to the spreadsheet.
To keep it simple, lets say I have two comment icons to click, one to add comments to the "Testing Completed?" field, and one to add to the "Sign-Off?" field.
The first comment icon is named TestCompIcon, the second is SignOffIcon, and the public variables they write to are called TestCompComment and SignOffComment respectively.
To avoid having to code the InputBox procedure for every comment icon on the userform, I was hoping that upon click, the icon would call a centralized routine that would establish the name of the variable that needs to be written based on the name of the icon comment that was clicked. Something like as follows:...............
View 9 Replies
View Related
Aug 7, 2013
I'm starting a dashboard, where on the front page I have two combo boxes on the left, and three empty fields to the right. I'd like the three fields to the right to auto-populate table-based values depending on the chosen criteria from BOTH fields (by store and month/date). I've attached a sample of what I've got so far. I've only provided three tables for this example, and I have a table with the same column/row titles for each metric and I have three different metrics I'd like to auto populate: COGs, Sales, and GM% or in the example, metric 1, metric 2, metric 3. No pattern in the table values, just wanted to populate the fields quickly. All fields are organized by store/month-date and I've set up a link to my combo boxes on a calculations tab.
View 2 Replies
View Related
Feb 7, 2008
I have some numbers in a column that I need to copy 12 times (each one) into another column. The problem is that I got like 200 records that will be converted in 15000 aprox. I've uploaded an example of what I need,
View 3 Replies
View Related
Oct 5, 2009
I would like the tab at the bottom of the sheet to Automactially name = to cell C5
So if Cell C5 = "Ryan"
The tab at the bottom of the sheet will be named "Ryan"
View 9 Replies
View Related
Apr 1, 2014
I'm building a sales tracking spreadsheet and need to find a way to auto group certain rows based on their cell value. In my tracker I'd like to group by company name and be able to collapse it to look at the details.
Here's an example of my starting point and how I'd like the data to look like in the end.
Starting State:
Company Name contact name sales stage Forcast amount
----------------------------------------------------------------------------------------------
Company A david brown contracts 10,000
Company A John Smith Won 20,000
Company A D'Arcy Davis Canceled 10,000
Company B
Company B
Desired State:
Starting State:
Company Name contact name sales stage Forcast amount
----------------------------------------------------------------------------------------------
+Company A 30,000
+Company B
View 1 Replies
View Related
Aug 19, 2014
I have a workbook with separate worksheets that I would like organized based on how old the data is. I want a macro that automatically cuts information from one worksheet and pastes it in the appropriate worksheet based on if it is 30, 60 or greater than 90 days old. So information will be cut from the "Archived Emails" worksheet and pasted into the "30 day archive" when it is 30 days older than today. It will then be moved from the "30 day archive" worksheet to the "60 day archive" worksheet when it is 31-60 days old, and finally moved to the "90 day archive" for anything over 90 days old.
Untitled.png
View 6 Replies
View Related
Feb 18, 2014
I have two problems:
1) Eliminating doubles when ranking
2) Auto-filtering based on cell values
The first problem is an issue with my formula I believe (I am using a RANK + COUNTIF-1) formula (Shown in tab #2, column L of the attached document)
The second problem will need a macro, but I am not very strong with VBA. In the attached document, I am looking to be able to filter the table in tab one based on the selections I have included at the top. I was able to filter the table based on # of IDs displayed using a formula. The second filter is looking to only show the values in the table that satisfy the condition that column E must match the filter chosen (cell C3).
For example, of the filter chosen in cell C3 is "Yes", I would like the table to rank and display only those rows with a "Yes" in column E.
Attached: Excel_Help1.xlsx
View 2 Replies
View Related
Jul 6, 2014
I am trying to work out the best way to do a spreadsheet to give me indicative costs. MOst of the costs are based on crowd size for an event, so when I enter the expected crowd size, I want the table to fill with the appropriate rates to give me a calculation of the costs for each line item.
My plan is to have a separate table or spreadsheet which lists all the rates for the various crowd sizes and as soon as you enter the crowd expected, it refers back to this table and auto fills the relevant values. To add complication, the rates can change for weekends and public holidays so I may need additional sheets to cover these scenarios. Below is an example of what I'm trying to do.
A B C D
CROWD SIZE
Cleaning
Electrician
Staff
Another table
CROWD: 10000 20000 30000
Cleaning $15,000 $18,000 $20,000
Electrician $500 $500 $500
Staffing $1.50 $1.20 $1.00
View 1 Replies
View Related