VBA - Summing Values That Have Shared Cell Value
May 9, 2014
I am trying to write some code to sum all values from a given range, where the Month matches i.e. = "Jan" and where another cell = "Yes".
Ideally the code would be flexible as to the Month value, as this list already exists on the spreadsheet, so it can be looped through. Here is an example of my spreadsheet data that I use:
Month
Stock Cost
Invoiced?
Jan
£60.00
Yes
Jan
£50.00
Yes
I'd like the code to loop through all rows where month = set value, and only sum those values if column Invoiced? = "Yes".
Sub CalcReleaseCost()
Dim StockCost As Range
Dim Month As Range
Dim Invoiced As Range
Dim MonthTotal As Variant
Dim x As Range
[Code] ........
View 1 Replies
ADVERTISEMENT
Feb 24, 2009
The simplified example below is intended to calculate the sums from the data values in the upper data set and place them in the appropriate cells in the lower summary table. Example......
I would like to find a single-cell formula that will handle the multiple instances of either the X or Y headings (ex: there are two 'Yes' Rows) and still reach the appropriate summations. I would like to accomplish this without resorting to Macros or manual cell references if possible. I've acheived some limited success with array formulae so far, but find that the multiple instances of 'Yes' cause only one row to be summed before the formula finishes.
View 2 Replies
View Related
Jan 31, 2012
Here's an example of what I need..
I want to
A B
2.5 corn
4 corn
7 green
2 green
I'd like a macro to find all corns, add up the column A for each corn and place the sum beside the last corn in column C
Then do the same with green, etc.
View 2 Replies
View Related
May 11, 2009
I have 10 columns (A-J). Column B is the Date & Column C is the Time, I have the data sorted 1st by date then by time. The 5th Column, E, is Size. The 10th column, J, is "Position."
This 10th column, J, is in binary format. A 1 equals a Position & a 0 equals no Position.
1) I need to find the Max Sum of the Size in which the Max consecutive set of 1s has occurred.
2) I need to also do this on a day by day basis, using the Date in Column B, without having to manually go through & modify all the formulas to reference the date.
I have a Sumif formula for the 2nd but it won't copy down to update the formula for each unique date. I have to manually change the date values & I have ~957 unique dates to do; so it would be a rather painstaking process if only done manually. Moreover, it doesn't count the Max Sum of all consecutive 1s in Column J...
The length of the non unique columns (all columns w/o unselecting the duplicate entries) is 19,068.
If you can be of help, I'd be very thankful...my brain is overloaded w/googling & using trial & error.
View 6 Replies
View Related
May 18, 2007
If I have two columns like so with Processor speed in the left and number of processors on the right:
SPEED NO OF CPU
7282
7282
7282
7281
7282
7301
7301
7302
7301
7301
7301
7301
7312
7312
7311
7311
SPEED ranging from 75 to 2000 or so Mhz, as many or as little multiples of each speed. I wish to go through this list using a seperate list of distinct values, and count the total number of CPUs for that SPEED. So, for the extract above I could manually tell you that there are a total of 8 processors running at 730Mhz
It would be nice to have a list of distinct vaues with a total count of CPUs to the right of each SPEED
730 8
731 17
756 9
834 2 etc
View 3 Replies
View Related
Jul 9, 2009
I'm working with a worksheet with 4000+ rows, so I'm looking for a formula to automate a summation. In Worksheet1 (4000+ rows) I have data from 1998 to 2008 for each month and day:
Year Mo Dy Data
1998 1 1 41
1998 1 2 35
1998 1 3 79
...
2008 12 29 39
2008 12 30 81
2008 12 31 42
In Worksheet2 (365 rows) I have data for just months and days:
Mo Dy Sum
1 1 94
1 2 103
1 3 222
...
12 29 65
12 30 211
12 31 98
I'd like to take each Jan 1 datum for each year from Worksheet1, sum them, and place the value in the cell that corresponds to Jan 1 on Worksheet2. I've primarily tried using the VLOOKUP function, but can't seem to make it work.
View 4 Replies
View Related
Jul 20, 2006
I have a chart of numbers pertaining to progress of a project by month. The
end of month dates are in a row across the top, the progress % are in
corresponding rows and columns below:
31-mar-06 30-apr-06 31-may-06 30-jun-06
5.5 3.4 1.2 2.6
I'm trying to do a SUM of HLOOKUP values to get a total progress for a given
month. For example, I need to see the total progress for end of May from end
of March: SUM(HLOOKUP(5.5) to HLOOKUP(1.2))=5.5+3.4+1.2 in a cell at the
end of the row. How can I do this? Do I need to use another function?
View 14 Replies
View Related
Apr 30, 2009
I am trying to do is summing a range based on a text value that corresponds to a cell address. I have a adddress cell value in say a1 = A$1$ and in a3 = A$10$. If I do a sum function where I want to use these cell values i.e. I use this formula but it does not seem to work, any insights?
SUM(Text(a1;"Text"):Text(a2;"Text"))
View 2 Replies
View Related
Mar 13, 2013
I have a cheque list with Column A for Cheque number, Column B for Date, Column C for Payee Name and Column D for Amount
Cheque number ranges from sequence 1200 to 3600
Is it possible to set up a formula to sum the amount of cheques in column D based on the cheque sequence number of column A . In other words if based on criteria cheque sequence number is
View 4 Replies
View Related
Jun 10, 2008
I am trying to setup a spreadsheet, where I am typing text into a cell, but I want that text to represent a numerical value, so when I do an auto sum, it tells me the totals. For example:
PaycheckBills to PayTotal of BillsJune 6, 2008Car- 1Car- 2WaterCableVisa1360June 20, 2008MortgInsuranceMCElectric2500July 4, 2008Car- 1Car- 2WaterVisaMC1460July 18, 2008MortgInsuranceElectricCable2400
Where Car-1 value is 500, Car- 2 is 500, Water is 60, etc...
Is this possible?
View 9 Replies
View Related
Sep 26, 2008
is there a simple way to sum the ten largest (or smallest) values? I just can't think of any formula to do the job, and a filter isn't an appropriate permanent solution.
View 9 Replies
View Related
Jan 15, 2007
How do I edit the VBA so that the 1st data cell is selected, and then the program calculates the sum of the data values, and then stop summing when I reach end of data?
View 5 Replies
View Related
Mar 22, 2007
I have a list of values at 'x' min intervals (the intervals sometime changes). I want to sum each hour's values eg. between 0:0:0 hour and 0:59:59, I want to add values 1040+800+860+870. Then I want to proceed and add all values for the next hour i.e. between 1:0:0 and 1:59:59, and so on. I have about 65000 of these calculations to do, so the need for some vba programming.
Hour value
0:14:531040
0:29:53800
0:44:53860
0:59:53870
1:14:53850
1:29:53860
1:44:53710
1:59:53670
2:14:53610............
View 5 Replies
View Related
Feb 8, 2014
We have a table that records payment dates and amounts ... and it categorizes how the payment was made. See attached file to understand the process.
Column A records the payment date. Two or more payments can be recorded for the same date!!!
Column B records the amount of payment.
Column C records the method of payment (OL or LB or CC or CK).
Here's what we need:
On a given date (cell J4), we need to match any dates in Col A ... and we need to SUM all payments that match that date .... and the SUM needs to be based upon the method of payment (OL or LB ...) and values stored respectively in E4,F4,G4,H4 (or left blank if no date match).
View 4 Replies
View Related
Jan 31, 2009
I am looking for help in developing steps in a spreadsheet to calculate a sum based on a few conditions. The basis of my spreadsheet works fine, however I am trying to add the contents of a cell to another by checking other cells.
For example:
Cells A1:A10 contain a numerical sequence (1-10 respectively) to indicate a "Node"
Cells B1:B10 contain a user selected number (1-10) which defines the Node it is fed from. We'll call this "Fed From Node".......ie. If Cell B2=1, that means that Node 2 is fed from Node 1.
Cells C1:C10 contain a value which is input by the user. We'll call this "Amps"
Cells D1:D10 would show the total "Amps" of the current cell added to all others that are fed from same.
What I am ultimately trying to figure out is how to add the "Amps" to each "Node" and show the results in column D.
More specifically if the spreadshet looks like the following: ...
View 9 Replies
View Related
Mar 4, 2009
I have three columns. Lets assume i have One header row and 3 rows of actual data and the 4th row is for totaling column B values.
Column A is a col of "Ingredients", column B is the amount of the ingredient (from col A) used. The value is either in Oz or Lbs. Can be either. Column C is a yes or no column. If the value is Yes then i want to have the value in col-B included in my overall sum which is in the 4th row. If the value is No then i do not want the value in col-b (in that row) included in the overall sum.
Any ideas on how to do this?
Thanks.
david
View 10 Replies
View Related
Jan 7, 2010
Several times per day, I have an excursion of a value over a specified limit. The excursions are measured in seconds. I am interested in a way to sum the number of seconds accumulated in a rolling 24 hour period. Is there an easy way to do this?
Example:
Time One 20 seconds
Time Two 35 seconds
Time Three 82 seconds
etc.
If time one and time two are within 24 hours of each other, the sum I would want is 55. This is in Excel 2007. a portion of the data is attached.
View 2 Replies
View Related
Aug 15, 2012
I am attempting to sum the final two values in a list. Each week, I add a new value to the bottom of the list. I would like the formula to calculate only the final two values, and update each week. For example, in Week 1, I would have the values 4,10,12,6 in Cells A1, B1, C1 and D1. The formula would calculate the sum of C1 and D1 = 18.
In Week 2, I would input the value of 15 into Cell E1. I would want the formula to now calculate the sum of D1 and E1 = 18.
View 9 Replies
View Related
Oct 11, 2012
I have the following code with uses a cell color to count the number of cells in a range with the same cell color:
Function CountColor (rng As Range, color as Range) As Long
Dim c as Range
Application.Volatile
For Each c In rng
If c.Interior.ColorIndex=color.Interior.ColorIndex Then
CountColor = CountColor +1
End If
Next
End Function
What I would like is instead of just counting and returning the number of cells of the same color, is for the code to return the sum of the values in the cells of the same colors. Cells being evaluated contain numbers from 1 to 300.
View 2 Replies
View Related
Feb 26, 2008
I need to sum a value that falls between 2 date ranges. I have read a few posts on this subject and thought I had it working, but I realized I was getting values in fields I should not be.
=SUMPRODUCT((Details!H2:H100>=$E$4)*(Details!H2:H100
View 9 Replies
View Related
Sep 24, 2008
So this code works fine without any error messages but I need to add a sum feature. Any ideas on summing up all the values from the for statement into the cell that corresponds to the value of the variable t. I think i need to store the the value of the for statement as a variable and then at the end of the for statement add the next value from the for statement and so on
Dim t As Integer
Dim m As Integer
t = 7
m = 11
Do While Cells(t, 7) ""
For m = 11 To (30)
col = Split(Columns(m).Address(0, 0), ":")(1)
Cells(t, 8).Formula = "=VLOOKUP(G" & t & ",indirect(" & col & 2 & "),2,FALSE)"
m = m + 1
Next m
t = t + 1
Loop
View 9 Replies
View Related
Feb 15, 2010
Attempting to sum Book Values for Units.
Unit numbers in one column, Book values in adjacent column
Some Units have one occurence, others have multiple.
Some Book Values will sum up to 0 while most will have a positive value.
Attached shows small portion of data that presents range of issues I'm working with.
View 3 Replies
View Related
Mar 27, 2014
I will set a base example first:
9 Nov 2012 Apple 5
12 Dec 2012 Apple 3
14 January 2013 Banana 8
17 January 2013 Apple 6
20 January 2014 Apple 3
I would like a sumifs formula that will only add the results for Apple - as follows:
Nov 2012 5
Dec 2012 3
Jan 2013 6 (i.e. does not include Banana - and also does not include Jan 14 Apple)
Although I have experience with sumifs I have not been able to use the correct syntax to identify the month AND year.
Ultimately I want to look through many hundreds of dates, and add anything that fits two criteria - 1) a 'name' criteria, and 2) it falls within a certainly month and year.
View 6 Replies
View Related
Nov 10, 2009
I am wondering if you can sum the numeric parts of a range of cells containing alphanumeric values. Here is an example:
values to sum: 500, a20, ab30
expected results: 500 + 20 + 30 = 550.
In this project, the number of values to sum is large and I do not wish to use long formulas to extract the numeric part of each cell within the range. I am also forbidden to use up extra cells as an intermediate working out. Can you help?
View 10 Replies
View Related
Jan 1, 1970
Can we convert the numeric amount into words..i.e. Rs. 148250.00 (Rupee One Lac Forty Eight Thousand Two Hundred Fifty Only)..Is there any simple formula in xls and ms access...
View 14 Replies
View Related
Aug 6, 2012
I have a sheet whereby in column A i have company names and column B how much is invested in this company so:
A B
AAPL 10
GOOG 5
MSFT 15
APPL 5
IBM 20
GOOG 10
What i would like to do via macro is take all the duplicates sum them so that i see AAPL as 15 but only be left with one row. So we would be left with only 4 rows each with their summed weight.
View 9 Replies
View Related
May 20, 2013
I'm trying to get a more manageable formula for totaling multiple values in one box using Vlookup. For clarification this is what I mean:
On spreadsheet A, I have this table:
[IMG][/IMG]
The value in B2 is the name of the item I am making and the items below are the components required to manufacture said item. In order to build them, I need so many (Column E) and I have indexed my remaining values simply by doing =E3-H3. To build each component requires minerals which are listed on a seperate sheet (Sheet B) as such:
[IMG][/IMG]
The only Value in the above table I am truly interested in is "Current" (E Column).
Back on SheetA, I have a second table which adds all of the component minerals up for a grand total of the minerals required to make the item in B2 as such:
[IMG][/IMG]
Now, this is my issue: The code for N3 is incredibly unwieldy:
=IF($F$3>0, $F$3*VLOOKUP($L3,
'Component Materials'!$A$15:$E$21,5,FALSE))+IF($F$4>0, $F$4*VLOOKUP($L3,
'Component Materials'!$A$25:$E$31,5,FALSE))+IF($F$5>0, $F$5*VLOOKUP($L3,
'Component Materials'!$A$45:$E$51,5,FALSE))+IF($F$6>0, $F$6*VLOOKUP($L3,
'Component Materials'!$A$55:$E$61,5,FALSE))+IF($F$7>0, $F$7*VLOOKUP($L3,
'Component Materials'!$A$65:$E$71,5,FALSE))+IF($F$8>0, $F$8*VLOOKUP($L3,
'Component Materials'!$A$115:$E$121,5,FALSE))+ IF($F$9>0, $F$9*VLOOKUP($L3,
'Component Materials'!$A$135:$E$141,5,FALSE))
I set this up to look at a specific value and if it was >0, it would multiply that value times whatever value it found on SheetB ("Component Materials"). The size of this formula makes this difficult to migrate to further items, so I would like to reduce the complexity of the formula.
View 7 Replies
View Related
Jul 22, 2014
I am trying to create an inventory control system that keeps tracks of what's in bins based on additions and subtractions to the bin. I am hoping to generate a summary output of bin contents based on the transaction list. I know how to do this using pivot tables, but am looking for a VBA or excel function solution since I will have hundreds of bins and thousands of transactions.
Bin number
Product Code
Pounds
1
A
50
1
A
-25
[Code] ......
I want to have the following table auto generated.
Bin
Product Code
Sum Quantity
1
A
25
1
D
75
[Code] .......
I'm using an array formula right now, but it is proving to be extremely slow.
=IF(ISERROR(INDEX('Harvest Generator'!$E:$I,SMALL(IF(LEFT('Harvest Generator'!$E:$E,LEN('Harvest Generator'!$E:$E))=LEFT(B$3,LEN(B$3)),ROW('Harvest Generator'!$E:$E)),ROW(1:1)),B$2)),"",INDEX('Harvest Generator'!$E:$I,SMALL(IF(LEFT('Harvest Generator'!$E:$E,LEN('Harvest Generator'!$E:$E))=LEFT(B$3,LEN(B$3)),ROW('Harvest Generator'!$E:$E)),ROW(1:1)),B$2))
Where Harvest Generator is the sheet where my table is on.
View 2 Replies
View Related
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
May 27, 2009
I have a set of data that I'm trying to identify the unique values in a column and then sum the related quantites against each of those values:
View 14 Replies
View Related