Selecting A Range And Then Summing That Range
Jul 19, 2006
I am trying to select a range of numbers based on an active cell. I then want to sum those numbers and have that total reported to a specific cell.
For example:
Say I have a column with a list of dates (Jan/04 thru July/06). I want the user to be able to click on any given field and have that field plus the 11 fields above it summed and reported. Any help?
I came up with something like
ActiveCell.Resize(12, 1).Select
This only selects the data from the active cell and goes down...I need the opposite. I need it to select the 11 cells above the active cell (plus the active cell) and sum that data.
View 4 Replies
ADVERTISEMENT
Jan 6, 2009
I have a simple sumif formula that says =SUMIF(W61:W112,"<30",J61:J112). In column W, there are values ranging from 0 to 5000. If the formula is written like it is above, it excludes summing values from column J when the cell in column W equals 0. Why is this? I can just add another function that says sumif "=0", but I don't think I should have to.
View 3 Replies
View Related
Feb 17, 2014
I am trying to create report of the in and outs of tools we are shipping for repair.
Currently in Tab 1
Column F - Date shipped for repair
Column G- Vendor Name
Column H- Date Returned
What I need in Tab B
Vandor - Total Sent- In Repair @ Vendor- Total Repaired - Total Unrepaired
Here are Images if it makes it a little easier to understand
The Info I currently have
image1.png
The info I required filled out based on the previous data
image2.png
View 6 Replies
View Related
Oct 2, 2008
To initialize some cells/ranges, I am copying a given range and pasting it to another given range using the. Copy and .PaseSpecial methods. However, it would seem that both methods actually select the range(s) for the operations, i.e. the given ranges(s) are activated/selected thus changing the focus on the spreadsheet. I would like to perform both operations without actually selecting the given ranges.
View 5 Replies
View Related
Apr 28, 2006
I am receiving a 'subscript out of range' error on the lines of code below.
I would note that all variables are declared and all seem meaningful as regards what you would expect at that point.
Below is a snippet from the immediate window which indicates what the values are:
completecashname C:CashDevelopmentMyFolderoutputCASH042706.xls
cashsheetname Formatted Sheet
cashcurrcolumn A
cashfirstrow 2
cashlastrow 876
Also the workbooks are both closed at this point (but it makes no difference)
Set CashCopy = Workbooks(CompleteCashName).Sheets(CashSheetName). _
Range(CashCurrColumn & Cashfirstrow & ":K" & Cashlastrow).Value
Set PelPaste = Workbooks(completepelname).Sheets(PELSheetName). _
Range((PELCurrColumn & PELlastrow)).Value
View 8 Replies
View Related
Sep 26, 2007
What i'm trying to do is select a range based on the date which happens to be in the first column of the range.
For example, I have a column (A) that contains dates and column (B) that contains names.
Its easy enough to select the entire range using
Range("A1:B4").Select
I need someting that will analyse column A and conditionally selct the range based on the date in column A (ie. it will only select the rows where column A has todays date).
View 9 Replies
View Related
Jan 30, 2012
I would like to get the sum of a range in VBA and tried the following that did not work:
S= Sum(Range(Cells(1, 1), Cells(1, 6)))
View 2 Replies
View Related
Apr 28, 2012
I have a set of 50 large spreadsheets each with the same size and structure.
I have a summary sheet which contains cells that each contain a single-cell 3D range across all the sheets.
But I'd like to modify this summary sheet to find a way of summing a subset of the 50 sheets according to a given criteria.
I imagine this could be a single criteria added to one cell in each of the 50 sheets.
Or perhaps it could be a letter in each sheet's name. eg, if the letters used as criteria are say G, P and S, I would name the sheets something like G1, P2, G3, S4, P5, ....S49, G50.
Perhaps this could be achieved with the indirect function or will it be necessary to resort to VBA?
View 9 Replies
View Related
Jul 27, 2012
I have a spreadsheet which has data in rows. I need to sum the first 5 values from the left of the range which are greater than zero. BUT if there are less than 5 non zero values present I want to sum from the right of the range.
First condition:
1 2 3 4 5 6 7 8 9 10
The function would return: 1+2+3+4+5 = 15
Second condition:
0 0 0 4 5 6 7 8 9 10
Function would return: 4 + 5 + 6 + 7 + 8 = 30
Third condition:
0 0 0 0 0 0 0 8 9 10
The function would return: 10 + 9 + 8 = 27
I have had success with:
=B4+SUM(SMALL(IF(I4:O4<>0,I4:O4),ROW(1:5)))
(using ctrl shift enter)
BUT it crashes when faced with the third condition.
I would also like to avoid ctrl-shift-enter functions if I can as I don't have much success copying them around the spreadsheet.
View 3 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
Apr 30, 2009
Trying to do the following. Look at a range of cells in a row, say A1- H1. Sum the last three cells that have a number in them versus being blank. So, let's say the last numbers in row 1 are in cells B1, F1 and H1, but in row 2 they may be in cells E2, F2 and G2.
View 3 Replies
View Related
Sep 8, 2008
I'm working on a worksheet that has dates in one column (column A), and numbers in another column (column B). What I'm looking to do, is look through all of column A, find all entries between a certain date (ie Nov 1 07 - Nov 30 07), and sum all the values in column B that correspond those fields, as long as the value is greater than zero or not blank.
So, for example,
A B
Nov 1 1
Nov 6 -5
Nov 3 6
Dec 6 5
Jan 1 2
I would need the formula to return 7
View 9 Replies
View Related
May 16, 2012
Column A shows a list of groups within an organization. A row across the top displays the month and year.
In a separate worksheet I have a table that shows a list of names, the group they work in and the range of dates they will be working in their group.
I'd like to create a table that calculates the number of participants/group by month.
View 1 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
Oct 12, 2006
I have to work on a sheet where the value in the cells is from a call to the GETPIVOTDATA() function. This may return #REF depending on the data. I need to sum a range of such cells treating a #REF value as zero. In another part of this sheet this is done by {=SUM(IF(ISERROR(D6:D17),0,D6:D17))} but as soon as I go to edit the formula the {} disappear and the formula wont work if I edit it. Putting the {} back in manually doesn't work either. How can I repeat what has been done before. (The sheet was originally created by consultants who have long gone and I have inherited it!)
View 2 Replies
View Related
Jul 11, 2014
So in my code I have two set ranges and want to select from one set range to another. The code I have now does not work because I cannot select Range("POBRF:PO"). This is the code.
[CODE]
ARow = Range("A" & Rows.Count).End(xlUp).Row
Set POBRF = Range("A1:A" & ARow)
BRow = Range("I" & Rows.Count).End(xlUp).Row
Set PO = Range("I1:I" & BRow)
Range("POBRF:PO").Select
[CODE/]
View 1 Replies
View Related
May 28, 2009
I am having trouble selecting a range in my data to copy to another worksheet. I have declared two variables (startcell and endcell), as seen below, as strings:
Cells.Find(What:=startdate, After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
startcell = ActiveCell.Address
Cells.Find(What:=enddate, After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
endcell = ActiveCell.Address
After this I would like VBA to copy all the variables in a range that is bounded by startcell and endcell. Here is what my code is currently for selecting the range:
Range("A2:" & endcell).Select
Instead of A2, I would like to select startcell, but I cannot figure out how. Currently I can get VBA to recognise endcell. For example, using the formula above I can copy the range from A2 to endcell. However, when I try and use startcell as the beginning of the range (in place of A2) the code does not work.
View 9 Replies
View Related
Jan 17, 2007
I have two tables in two different worksheets. In the first table, rows get deleted if the value in column 'S' (the first row to the right of the table) is not '1', and columns get deleted if the value in row '2' (third row above the table) is not '1'. In the second table, the number of columns stays always the same but rows get deleted if the value in column 'N' (first column to the right of the table) is not '1'.
After the rows and columns are deleted the tables get pasted in a ppt presentation.
Now the problem: I am a beginner in VBA and up til now I am only able to define a certain Range, e.g. ("A5:M17"), to be copied and pasted into ppt. But since the tables will sometimes be bigger than other times depending if rows/columns are deleted, I would rather define a dynamic Range. The top left cell of both tabels to be copied is always 'A5' but the bottom right cell changes.
View 2 Replies
View Related
May 12, 2011
I often find myself in the following situation - I will highlight a range of numbers to see what the sum is in the bottom right hand corner (the cells which I select areoften not all within the same column or are not consecutively listed under each other) .Depending on the circumstances I will then type out a SUM formula with the range to put that value somewhere in the spreadsheet - the problem being that I have to deselect the cells and then re-select these within the formula. When I have selected many numbers, it is not always easy to remember every number which I included.
As a way to remember the numbers, I format those cells in a certain colour before I do the SUM formula and would then include only those coloured cells in the formula. I would like to avoid this extra bit of work.
I am new to VBA but would like some form of code that allows me sum the contents of a selected range and paste that formula beneath the last value in the range - the range would have been selected before running the maco.
View 7 Replies
View Related
Aug 7, 2012
Im struggling how to even start writing this code. What im trying to do is go down column S from row 2 down and sum up each cell until the sum = 700 then delete all the rows below that with some thing in them.
View 2 Replies
View Related
May 3, 2007
I have a spreadsheet which links to an external source, runs a sql msquery and retrieves data based on dates selected by the user from two drop down lists. From Date and Date To.This works fine. However I also need to total any fixed data which resides in the same spreadsheet based upon the same dates selected. The end user selects 2 dates , say 15/04/2007 (this relates to a week number,week15)and 28/04/2007(week 17)
A column of data lists the week numbers (in cells A3 - A22) and next to this their respective production quantities in cells B3-B22.
I now have a problem in totaling the production quantities in the worksheet as my user is not just selecting the week numbers 15 and 17 but 15,16 and 17.
qty
week 15100
week 16123
week 1789
How do I sum from 15 to week 17 inclusive or any other range selected?
View 7 Replies
View Related
Nov 12, 2008
I have a spreadsheet with Employee details and each employee has a Indicator and a Score.
I'm battling to get Excel to do a lookup on the Indicator, find the applicable Score Range, see if the individual's Score falls within the range and then inserts the relevant % into a cell in a specific row of each employee.
If we did not have more than 2000 doing it manualy might have been an option. Also, the Percentages and Score Ranges in the matrix might change a couple of times....
View 6 Replies
View Related
Feb 8, 2009
I am having a few problems selecting a range. What I am trying to do is select a range where the number of columns stay the same, but the rows are variable; ranging from one row upwards. At the end of the rows, there is a blank row. I currently have;
View 2 Replies
View Related
Jan 31, 2009
I am trying to select a range of cells. The range I need to select starts in Cell A1. I need to select every row with data in column 1 up to the first row with no data. I then need to expand the range to all columns up the last column with data, including columns with blank cells.
The problem with my code relates to the selection of columns. It is only selecting up to column F. Column G is empty, Column H has data, Columns I-J are empty, Columns K-R have data.
View 5 Replies
View Related
Apr 4, 2013
I want to copy a range where the row is variable (i in the Loop I'm doing) but the columns stay the same. What am I doing wrong?
Workbooks("Labor Info").Sheets("Transfer").Range("A" & i & ":E" & i).Select
View 1 Replies
View Related
May 13, 2013
I was trying to select all of the pictures/objects in a certain range (A294:L1400) in order to move them all at the same time. How do I do this?
View 1 Replies
View Related
Jun 23, 2008
How would I select a range using variables? For example, say I wanted to say
myRange = Sheets(1).Range("A1:A100"),
but the column was variable. How would I do this if the column number was stored in a variable?
View 9 Replies
View Related
Feb 26, 2009
I need to select starting with:.
Columns A-O
Rows 1 - ( LR of ColB - Col A is empty )
View 9 Replies
View Related
Mar 4, 2010
I'm trying to obtain a formula that allows me to select the last 20 numbers in a range of numbers that continue to increase weekly. i.e column a3-a3000 increases by one number every week. I need the formula to sum the lowest 10 numbers of the last 20. If there is 30 numbers from a13-a33 week one. I require the formula to pick up the 10 lowest from the last 20 (a13-a33). Week two the cell increases by on to a34. The formula would then have to pick up the lowest 10 from the last 20 (a14-a44) and so on.
View 9 Replies
View Related
May 13, 2006
I have attached a spreadsheet...I'm trying to select Range A1:N16 using VBA code...
Range(activecell,activecell.end(xltoright)).select
Range(selection,selection.end(xldown)).select
When I use this code is only gets A1:N6...: is there anyway to get it to select the range all the way to the end of the data. I tried CurrentRegion and some other stuff but can't get it to work.: The range may go upto line 500 or 3 I just never know.
View 4 Replies
View Related