Macro To Subtotal Varying Lists Of Numbers
Apr 17, 2014
I am fairly new to excel and I am having trouble trying to get a sub total function to work for me. I need the subtotal to for a list of about 20 columns in one line with a varying amount of rows. So the subtotal must stop when there is a blank at the top. I can get the macro to find the totals A on the spreadsheet and then offset to beneath the columns of numbers but the sub total formulas takes in every number. Here is the example:
456.00
8,798.00
45,465.00
789,789.00
45,465.00
789,789.00
45,646.00
7,897.00
Totals A
[Code] ........
View 9 Replies
ADVERTISEMENT
May 1, 2014
I've reached a point in this macro where I'm stuck with NO clue how to achieve this, or even whether it can be done. In the Before sheet below, I need to bold the cells in H & I if the word "Total" is in G. I could probably manage that part, but here's the weird part: I need to add a formula to H & I of each row with "Total" in G to sum the numbers above it, from the previous total down to the current total. But there's no telling how long each range might be on a given report; from 1 row up to 8 rows.
THEN, in the second row below the end of columns H & I, I need to put a formula totalling all of the preceding Totals
I wonder if there might be a way to tell it to put a formula in H by each cell that has "Total" in G, with the formula summing or subtotalling everything from the cell in H that has data in F to the cell just above the "Total".
Attached File : Acct Activity.xlsx
View 14 Replies
View Related
Jan 13, 2003
I am putting together a macro to import a CSV file onto excel. I will be manipulating columns of data (concatinating some, dividing by 100 etc.)
What I am having trouble with is that each file imported will have different number of rows.
I tried, in recording a macro, to use autofill (entered formula and double-click fill handle to drop the fourmula into each cell) hoping this would show me how to do it but alas, it just coded the range as the starting and stopping cells (didn't show a count formula or some such.
View 9 Replies
View Related
Aug 17, 2007
I have attached my relevant spreadsheet. I have an Active List of regional numbers per Site (Branch) for our office Their is about 8 records (rows) already in the list and the rightmost column is my "Running Total" (RunT) column with Formula "=--SUBTOTAL(109,$F$2:F2)" This formula was copied and pasted downwards for the 8 existing records. It then of course adapts and extends the range of the formula accordingly. That is why only the one side is pegged ($F$2). It works great as a running total for any filter cenario I choose for the existing 8 records.
NOW, however, if the user adds another record/row, the Total Column Autofills
the next row's formula correctly as is the advantage of Excel's "Active declared"
Lists. BUT, the Running total column (RunT) with the subtotal formula goes all
weird and autofills the next row formula in such a way so that it changes the
previous row's formula and from then on the range it uses (in the subtotal expression) always updates itself backward up and until the point of the first user-entered record. It changes ALL the Subtotal formula-ranges of the user-entered rows! This is very unusual and unfortunate. This ruins the whole idea of having a "per row" running total on the right end of my list that is always correct even if I filter the list.
View 5 Replies
View Related
Aug 15, 2012
I am trying to do a VLOOKUP using a list based on our Part numbers in Excel 2007. When I do a normal sort it groups the numbers 1 thru 9 by the number of digits, giving me multiple list of 1 thru 9. When I do my lookup it will not find the shorter numbers. Is there some way to sort these Part numbers in order regardless of the number of digits?
View 2 Replies
View Related
Mar 27, 2009
I have a column of contract numbers of varying length. I want to run a sumif of all of the values on my reference sheet that have the contract number beginning with the contract number in my listing. All of the the contract values in my reference sheet are very long. Since the numbers I am working with vary in length, i don't know how to match this string in the sumif function
I want something like this
=SUMIF('Reference Sheet!$A$5:$A$13410,LEFT("", LEN('Select Contracts'!$C6))='Select Contracts'!$C6,'FINALIZED DATA'!$H$5:$H$13410)
Is there a way to refer to the range in the sumif function,
View 9 Replies
View Related
Aug 7, 2013
I am attempting to have cells in Column 'U' deliver different drop-down menus based on the corresponding value in column 'D'. I have created 7 named lists:
List_117G
List_152
List_JMET
List_XBAND
List_PACWIND
List_VORTEX
List_ROVER
Those lists will be called up based on 7 values in column “D”:
“G”
“152”
“J”
“X”
“D/E”
“V”
“R”
So far I have only been able to get this to work for the first category “G”. When I change the value of column “D” from “G” to “152” I no longer get a drop-down. Here is the formula I am using in the List function of validation.
=IF(D6="G",List_117G,IF(D6="152",List_152,IF(D6="J",List_JMET,IF(D6="X",List_XBAND,
IF(D6="D/E",List_PACWIND,IF(D6="V",List_VORTEX,IF(D6="R",List_ROVER,)))))))
View 2 Replies
View Related
Jun 28, 2012
There are 11,000 rows and 4,000 are unique. The goal is to merge the data down to the 4,000 records. Each of the unique entries shows up 1 to 15 times.
In trying to solve this, I wonder if I should break this down into the different # of occurances and implement specific solutions. e.g., There are
5700 entries that show up 2x
504 that show up 3x
24 that show up 12x
View 3 Replies
View Related
May 24, 2014
a formula to extract the numbers into two separate fields. The text may vary in length and the numbers vary in length also from 1 digit to 2,000,000.
Data in A1 is as follows:-
Meter reading Old:1345 New:67890
View 9 Replies
View Related
Oct 2, 2013
I want to call a macro with a varying name that is within a module with the same name.
I have a module called Test1 and within this, a macro name called test1
I have a module called Test2 and within this, a macro name called test2
etc
On another module called Test8 (with the macro called Test8), this Test8 macro will call either Test1 or Test2 or Test3 etc depending on what I choose in an excel spreadsheet. So on sheet1, cell A1, there is a drop down with the options Test1 or Test2 or Test3 etc.
The following works to run the macro test1 from module test1 (when it does not vary i.e. i physically put in the name of the macro myself):
Sub Test3()
Test1.Test1
End Sub
The following works to run the macro test2 from module test2 (when it does not vary i.e. i physically put in the name of the macro myself):
Sub Test3()
Test2.Test2
End Sub
etc
However, if I try it so that the calling of the macro varies as below , it does not work:
Sub Test3()
MacroToCall = Sheets("Sheet1").Range("A1").Value
MacroToCall.MacroToCall
End Sub
View 7 Replies
View Related
Dec 10, 2009
I have dollar amounts that I need to distribute amongst varying numbers of columns and not have have the total distributed be over or under the original amount by any number of cents. When I simply divide the dollar amount by the number of columns, the total of those columns can sometimes be more or less than the original dollar amount by a few cents.
e.g.
Dollar # of A B C All Columns
Amount Columns Total
--------------------------------------------------------------------
$25.05 2 $12.53 $12.53 $25.06
$11.47 3 $ 3.82 $ 3.82 $ 3.82 $11.46
$25.05 divided into 2 columns gives $12.53 in Column A and $12.53 in Column B. Total of Columns A and B is $25.06. Over by a penny.
$11.47 divided into 3 columns gives $3.82 in Columns A through C. Total of Columns A through C is $41.46. Under by a penny.
I know I could simply always add or take away the pennies from one column, but I would prefer the process to be random or formulated in such a way that the Column to which the extra pennies are added to or taken away from differs in order to be "fair to each column".
View 10 Replies
View Related
Mar 1, 2006
Reference a subtotal relative to one of it's lines.
Example
Product # Salesperson Quanity
Percentage
1 Amy 10
**
1 Ron 20
**
1 Jim 25
**
Product # 1 Total 55
2 Amy 15
**
2 Ron 15
**
2 Jim 35
**
2 Bill 20
**
Product # 2 Total 85
3 Jim 35
**
3 Bill 20
**
Product # 3 Total 55
I of course want to calculate the percentage column by dividing the quantity
by the total. The problem is that the relative position of the total varies.
Is there a way to do this without using code?
View 10 Replies
View Related
Aug 21, 2007
The following is what I have in A1:C3.
4 TRUE 0
4 FALSE 4
4 FALSE 4
The Formula in C1 is =IF(B1=TRUE,SUBTOTAL(9,C2:C3),A1)
This formula is then copied down to C2 and C3. I want this formula to subtotal the next two numbers if the cell to the left is true. Right now it is giving me 0, but it should be giving me 8.
View 9 Replies
View Related
Jul 25, 2011
I need to concatenate varying numbers of cells based on duplicates found in a separate column, but I'm not sure how to approach it. I have 41,000+ rows of data, so I have to find a formula.
Example:
1AB2Denton, PaulFB357D4D3OwensTest, MarcyFB539F934Brennan,
JosephFB539F935Bowser, AmyFB539F936LaRock, ChuckFB667D3B
Based on duplicates in column B, I want to combine the data in column A into one cell. The duplicates in column B could be only 2, or could be 20+.
View 2 Replies
View Related
Jul 29, 2009
if you can remove the word total from each cell without deleting the numbers after you copy from a subtotal list?
View 9 Replies
View Related
Jul 13, 2007
I paste in information in Columns A-E with varying lengths for each report that I need to generate (They generally range anywhere from 10-500 rows). I have formulas already in place in the first row of Columns F-L that need to be copied down as far as columns A-E go. I recorded a macro for this when I try to run the macro for another report with more or less row entries it copies down as far as the original recording was set. How do I make it so the rows will copy down just as many as I need and not some arbitrary number of rows? This is my first post so if any clarification is needed that's no problem.
View 3 Replies
View Related
Aug 22, 2009
I've trawled a few forums for a while now trying to find a macro that matches my specifications, or one I can adapt but so far have been unsuccessful, so here goes:
I have one column of data (col. A) of customer names and addresses each with an empty row in between them. The lines of data relating to each customer vary from 6 rows to 14 rows, then an empty row, then the next customer and so on - for several thousand rows.
I am wanting to create a macro that will transpose each customer to either their own row in sheet2, or to column B and then delete column A at the end.
All I can find is macros for a specific number of rows rather than varying. One way would be to have a code that 'pads' out those customers with fewer than 14 lines by inserting rows to make them 14, and then a code to transpose 15 rows at a time.
View 9 Replies
View Related
Mar 16, 2007
I have a worksheet (downloaded from Paypal) and the columns I need to sum are of varying length (sometimes 12 rows and maybe 200). I am having trouble finding a way to find the end plus one of the column to write the formula in.
View 9 Replies
View Related
May 2, 2012
I have a column of data where the seperate entities are divided by blank rows. for example: i need to calculate sum(G3:G15) then skip the blank row (G16) and calculate the next group, say sum(G17:G50) and export that import to a new worksheet.
The issue is that the column lengths vary from day to day so the blank rows will not be in the same position.
View 2 Replies
View Related
Feb 5, 2007
way to do this but i have a sheet that is into 5 - 6 thous rows, in one of the columns (names) i sort it by names and then order it by subtotal for certain values.
What i need to know, is there anyway i can take just the subtotal values out and put onto another spreadsheet without copying and pasting it all as there are lots of subtotals and this would help alot as the other info is not nec. just the subtotal'd info. either that or is there anyway i can highlight the subtotal'd row info in yellow/bold text anything like that that would make it stand out without having to do it manually?
View 12 Replies
View Related
Oct 23, 2008
Im trying to get my sheet so that at each change in month it creates a sum of the value but I want to sum to show up in the subtotal value column.....
View 10 Replies
View Related
May 1, 2013
I have one worksheet with four columns of data. Column A is a well name, RA-0001, column B is the measured depth of the well from 0 feet to however far down it goes, anywhere from 4000 to 15000 feet, column C is the inclination of the well, column D is the Azimuth.
I have 500 wells from RA-0001 to RA_0500 or so all in this one worksheet, all the wells have varying Measured Depths associated to their well name. I need to create a macro that can separate the wells and either put them in a new worksheet for each well, ie. a worksheet named RA-0001, RA-0002, ..... ect. OR, and this would be nicer, a macro that can actually save all these individual wells as (Formatted Text (Space Delimited)) files with the associated well name.
Here is an example of what it looks like. The columns do not have a subject line to state what information is in each column because I dont need it in that format.
RA-0001
0
0.00
0.00
RA-0001
100
0.91
5.56
[Code] .......
Even just knowing how to create a simple macro that would take all the data from each well so I could manually copy and save them as new files.
View 7 Replies
View Related
Oct 10, 2008
I've modified this macro I found on this forum, all it does is compares 2 lists of 6 digit serial numbers and and then tells me which numbers are in list 1 that are not in list 2.
However, I want to modify it so that it also gives me the numbers in list 2 that are not in list 1 (put into column F). I then need it to cut the matching serial numbers (in columns A and B) from sheet 1 and paste them into sheet 2.
View 5 Replies
View Related
Mar 18, 2007
I have a spreadsheet that has columns for "Invoice Number," "Order Number," "Invoice Date" (DD/MM/YYYY), & "Amount." It is formatted using a macro.
I need macro code that will group all invoices by month and subtotal each month, then put a grand total at the bottom. Also a blank row needs to seperate each month.
View 10 Replies
View Related
Aug 27, 2008
I'm having difficulty allowing my macro to run in a more global environment with varying data-set lengths.
For example:
Though the following "copy" scenario works for me when my data set is contained within cells B2:B35:
Range("A2:A35").Select
Selection.Copy
It does not allow me to work with a set of data that extends beyond this--say to B50 or B60. Is there any way to allow this command, and others, to be a bit more flexible with my data set lengths?
View 9 Replies
View Related
Apr 4, 2009
I have a spreadsheet that has two different data sources (i.e., A and B). The amounts of these data sources (i.e., the number of columns) varies from sheet to sheet. I have to calculate the averages of these data sources independently and together. Because this data is spread across twenty or more spreadsheets, these calculations can be time-consuming. I want to do the following:
1. Locate the last occurrence of the first data source "A" in row and then insert a column after that cell.
2. In that cell, I want to get the average of each data source for each row of data (i.e., there are always 19 rows of data).
I want to do the same two steps for the second data source "B". Then, I want to insert a column after the "B" average and this column will be used to get an average of each row of data from A and B together. Please keep in mind that the number of data sources for A and B varies from sheet to sheet.
So far, I am working on code to try to " find" the text in a range (i.e., find the last instance of "A"), but I cannot figure out how to get it to get it to stop at the last occurrence and then insert a column. I have some ideas about how to calculate the average, but any of yours are much appreciated.
Also, the row with the type of data (i.e., A or B) is named because this function is part of a larger macro. Therefore, it is relatively easy to get to it.
I have attached a version of the file that displays how I want it to look.
The code I have thus far is:
Cells.Find(What:=A, After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=False).Activate
View 9 Replies
View Related
Jan 15, 2009
I've got a semi-recorded macro to format a report I run, and towards the end it deals with sorting, subtotalling, formatting text etc. The main function of the macro is to split a large report into several smaller reports defined by whichever manager name appears in the relevant column. The smaller reports need subtotalling by 2 different columns so I have the following macro code :
Cells.Select
Selection.Subtotal GroupBy:=2, Function:=xlSum, TotalList:=Array(5), _
Replace:=False, PageBreaks:=False, SummaryBelowData:=True
Selection.Subtotal GroupBy:=1, Function:=xlSum, TotalList:=Array(5), _
Replace:=False, PageBreaks:=False, SummaryBelowData:=True
For some reason this only subtotals by the second column and not the first. I tried swapping them over so GroupBy1 then GroupBy2 but it's still the same. Anyone got any ideas why this might be? I appreciate it's not the smoothest code I could use but I don't know enough about code to do any better.
View 9 Replies
View Related
Mar 5, 2009
how to code a macro that totals columns d through z on several worksheets that have various numbers of rows. Each sheet has the same number of columns but different numbers of rows.
View 9 Replies
View Related
Dec 30, 2006
I want to know VB code for excel subtotal function. Actually what I want to achieve is as follows. I have data for particular financail year with almost 15 columns. One column contains date. I want to take subtotal for each month ( say for Jan, Feb and so on ) for each column.
View 2 Replies
View Related
Jan 14, 2013
I am trying to create a macro which will use the subtotal function to do a count on all the the new loans in column A. The could below is what I have tried but I am getting a run-time error 13 "Type Mismatch" error at the line highlighted in red in the code. How to write the Subtotal function in the macro.
Code:
Sub CountNewLoans()
Dim cnlFinalRow As Integer
Dim cnlRow As Integer
Dim x As String
Dim y As String
[Code] ......
View 6 Replies
View Related