Dsum With Non-contiguous Range Criteria
Dec 28, 2007
Is it possible to use a non-contiguous range for the criteria parameter of the DSUM function? I want to do something like this. =DCOUNTA(wholesale_all,"Assignment Date",D2:D3,G2:G3) This formulas won't work the way I have it typed, but is there a workaround to achieve the same result?
View 2 Replies
ADVERTISEMENT
Mar 11, 2009
I have a list of data with salesperson and qty. (Excel 2003)
I am using dsum and it was working great until I add a new sales man who happened to be the son of another salesman.
example.
when I just had Bill Gates his total (DSUM) was fine.
now I added Bill Gates Jr.
since then Bill Gates totals now include Bill Gates AND Bill Gates Jr.
FYI - Bill Gates Jr. totals are correct.
View 9 Replies
View Related
Sep 20, 2006
I have a workbook with three diffrent sheets (and more, but they are not relevant here), each with its own webquery. After a query has been done I check with the OnChange- event, and that works fine. My problem is that I want to save the document after the queries has been done, but if I save it after the first one is done, the second and third queries are aborted. Is there any way to see if a query is being refreshed or not. If I can see that a query is refreshing, I can tell the macro not to save, and when the last one is done it will save there instead (I have no idea if its going to be the first, second or third query thats being refreshed last, as they take diffrent time to perform). I was thinking of something similar to:
Sheets("Sheet2").Select
If Not ActiveSheet.QueryTable.Refresh Then
Call SaveDocument
End If
Now, this doesnt work since the querytable doesnt have the refresh-propery to cehck, but its something like this I would like.
View 8 Replies
View Related
Jan 5, 2009
You can see there is an equation for: The total profit from apple trees. The maximum profit of apple and pear trees. But, there is no example for the total profit from pear trees.
I have an excel spreadsheet that I need DSUM to work not only for A1:A2 (apple tree), But for A3 (pear tree), A4 (another tree), ext. But I don't want it to sum A1:A4 (A1 + A2 + A3 +A4), I just want A4's sum. Or from the example, I want just A3's sum for just pears, but when I put in A1:A3, I get the some for both apples and pears.
View 4 Replies
View Related
Dec 15, 2008
Ihave the following headings in a database. CSAMeeting DateMeeting typeCompanyInhouse Products/FundsJV Product 1JV Product 2VenueSales Manager2nd Manager (JP, KMcI SS)Inv. ManagerFilenote IssuedWorking DayNo. of AttendeesCancelledPack RequiredCompliance Required DivisionReason for no Compliance"Date sent to Compliance""Pack/Literature Used"Pack Path.
i want to use the Dsum to produce the total amount of managers met for a cvertain sales person for a certain type of meeting. I trued thr following but it is returninga #value =DSUM(A27:V1028,13,AND(3=$BH3,9=BI$2,12<>0)). where 13 applies to the number of managers column 3 is the meeting type 9 is the managers name 12 ensures that its only counted if teh meeting note is done.
View 4 Replies
View Related
Nov 29, 2007
I'm trying to do a DSUM based on a unique reference number. As I have 500+ such numbers, I need to automate the criteria array based on the reference number.
This is as close as I've come:
DSUM('Income'!$A$1:$Q$37735,"US FREE AMT", LOOKUP(A2,Criteria!$A$1:$BX$2,OFFSET(Criteria!A1:BX2,-1,1,2,2)))
LOOKUP, of course, wants to return a value instead of a range, so this only works as far as getting me to the right cell on my criteria sheet.
How can I get a range 2 rows deep by 2 columns high from the results of a lookup/search?
View 4 Replies
View Related
Dec 15, 2008
Ihave the following headings in a database
CSAMeeting DateMeeting typeCompanyInhouse Products/FundsJV Product 1JV Product 2VenueSales Manager2nd Manager (JP, KMcI SS)Inv. ManagerFilenote IssuedWorking DayNo. of AttendeesCancelledPack RequiredCompliance Required DivisionReason for no ComplianceDate sent to
CompliancePack/Literature
UsedPack Path
i want to use the Dsum to produce the total amount of managers met for a cvertain sales person for a certain type of meeting. I trued thr following but it is returninga #value
=DSUM(A27:V1028,13,AND(3=$BH3,9=BI$2,120))
where 13 applies to the number of managers column
3 is the meeting type
9 is the managers name
12 ensures that its only counted if teh meeting note is done.
View 9 Replies
View Related
Jun 1, 2007
I have a DSUM function with multiple criteria that are linked to user selections on a different sheet. If the user doesn't set a value for a particular field, the cell is blank and the DSUM should sum records with both blanks and non-blanks in that field.
Unfortunately, simply setting my criteria formula equal to that cell does not accomplish this. I've implemented an if statement to help but am having trouble defining a single criteria for returning everything.
Simply pointing to named range doesn't work for blanks and nonblanks when the cell is empty because it returns a zero: =SelectedValue
Criteria formula #1 I'm using: =if(SelectedValue="",="=*",SelectedValue)
Criteria formula #2 I'm using: =if(SelectedValue="",="<>*",SelectedValue)
When the SelectedValue cell is blank, these two formulas ensure that all records are summed. I would like a criteria that sums both blanks (=*) and non-blanks (<>*) without having to use two separate cells for the criteria. This gets unwieldy when trying to combine it with criteria for other filter fields.
View 9 Replies
View Related
May 22, 2014
I have attached a very simple model of a much larger BI report that we use. I have written a DSUM that returns the correct result in all cases other than when one of the criteria columns is blank. When one or more columns is blank, the result returned is 0 whereas I need it return all data (for e.g. if you remove "sains" from cell B2, I need it to still return data for person "b", "c" and "d" (i.e. 51 for Mar14)).
Attached File : DSUM (2).xlsx
View 3 Replies
View Related
Sep 21, 2006
I currently have a report with so many large array formulas that it is virtually unusable. I want to use the DSUM formula in place of my array formulas but I am vexed in regards to creating a DSUM formula that I can put in the top-left cell of my report and then copy down to the bottom right side of my report. Currently, the array-formulas sum data from a large list when it meets two criteria -- one part of the data-record in the list must match the row label of the current row in the report and another part of the data-record in the list must match the column label in the current column of the report. I have found with the DSUM formula that you can use a "formula" criteria in place of a static criteria...the problem I am having is that the part of the formula that points to the data-set must be relative while the part that points to the formulas criteria needs to be static -- in order to be able to make one DSUM formula and copy it down and over I would need my formula criteria to have the opposite setup (with the data-set part static and the formula criteria as relative).
View 9 Replies
View Related
Aug 15, 2007
Does anyone know how, to count the same text, but on occasions?
So basically, I mean, if the letter 'S' was in 10 cells, but on 3 different occasions (meaning the cells aren't one after the other), how do I count the fist 'S' of each occasion it appears?
View 9 Replies
View Related
Sep 9, 2006
I would like to be able to count the amount of entries in column C and depending on the amount group them in either groups of 3 or 4, all names would be unique...so if there are 14 names in the list they would need to be grouped in to two groups of 4 and two groups of 3, if there were 19 then 4 groups of 4 and 1 group of 3 etc to a maximum 50 people, the results could appearon a seperate worksheet say pasted on to the worksheet starting with the groups of 3 (so paste a group of 3 then skip 3 rows then paste groups of 4 skip 2 rows, the row skipping is to allow seperation and manual entry of extra data). There will never be groups of 5 or more and never less than 3
View 8 Replies
View Related
Jan 8, 2006
Range:
C3,C14,C25,C34,C41
Criteria:
>0
sum-range:
C3,C14,C25,C34,C41
I can't get that to work since the commas in the range are throwing the function off.
View 14 Replies
View Related
Jan 8, 2006
range:
C3,C14,C25,C34,C41
criteria:
>0
sum-range:
C3,C14,C25,C34,C41
I can't get that to work since the commas in the range are throwing the
function off.
View 13 Replies
View Related
Aug 17, 2012
I know how to find the last row of a continuous range. it's simply:
Code:
someRng(someRng.Count).row
How do you find the last row of a non-contiguous range though? Assume the range is vertically laid out and I don't want to do any looping.
View 9 Replies
View Related
Apr 8, 2008
Is it possible to re-size a non-contiguous range? I'm guessing "no", and a Google trawl hasn't provided me with anything.
Here's what I'm trying to do:
dim mult_rng as range
dim rng2 as range
set mult_rng = range("A1:B1,D1:E1")
set rng2 = mult_rng.resize(rowsize:=10)
That is, my original range is comprised of non-contiguous cells in the same row. When re-sizing, I'm trying to increase the number of rows, but leave the columns the same.
Like I said, my gut instinct says that this isn't possible using the 'resize' property. Can anyone think of another method to use? My constraints are that the original mult_rng isn't always the same (and isn't always non-contiguous).
View 9 Replies
View Related
Oct 3, 2009
I want data to columns A, C and E, while I have important data in columns B and D. Should I make three queries? Should I make query and save the results to temporary place and then move all the results to those columns A, C and E?
Right now the copying happens like this:
If Not rsData.EOF Then
rngTarget.CopyFromRecordset rsData
Else
MsgBox "No records returned.", vbCritical
End If
So should I do
1) One query and move everything in the right places
2) Multiple queries
3) Something else
Does this depend a lot about how many results I expect? I'd say likely about 100, maybe less than 1500, never more than 10000
View 9 Replies
View Related
Mar 19, 2013
Need code that will search non-contiguous range for first empty cell, paste data into found cell and data into offset cells and end search. If not empty, move to next cell in non-contiguous range. If NO empties are found in entire range, a msgbox.
Non-contiguous range: Range("B2,B32,B62,B92,B122,B152,B182")
Pasted data: 1st range into found empty, 2nd range into range offset of empty.
View 9 Replies
View Related
Jan 20, 2010
I'm trying to do a vlookup on a non contiguous named range.
I have a non contiguous named Range called "temp".
View 6 Replies
View Related
Jan 25, 2009
When I insert a line to select the range on the Worksheet it does select the range named as temp. However, the array does fill but only with the first part of the range eg in this case A7:C44.
My aim is to create an array of size point1A( all the rows in the multiple ranges, 3 columns).
Example of a Range to be assigned to the Array point1A. temp = "A7:C44,D7:F44,G7:I44,K7:M44,N7:P44,Q7:S44,"
View 6 Replies
View Related
Jun 4, 2012
I am trying to create a large range composed of smaller ranges. Some of these ranges may overlap so I want to make sure when I add cells to the range they don't already exist. I know how to make sure the same value doesn't exist in a range, but not the same cell.
View 2 Replies
View Related
Apr 13, 2008
I have a contiguous range of rows starting from row 5. ...It starts from row 5 but could end anywhere below.
The name of my Sheet is Tester.
Now in Tester, columns B,C, and D have numerical values in them. Using VBA, how can put in values in corresponding row of column A.
So if there are values from B1:D39 and B40 onwards is empty, then A1 will have value B1*C1*D1, then A2 will have B2*C2*D2 and so on until A39 = B39*C39*D39
**I need to write the code so the whole process is done fastest.The code may be long but the macro needs to run as fast as possible.
(Also, I remember using Screen.Updating = False when I wrote similar stuff many yrs ago. Would this be useful here?)
View 9 Replies
View Related
May 29, 2009
Is it possible, through VBA, to select the top right cell in a non-contiguous range? For example, I have defined A1, A3, and A5 as a range. How could I tell Excel to select A5 from within that range?
I am using Excel 2007.
View 9 Replies
View Related
Dec 17, 2006
I'd like to count non blank cells in 16 separate ranges (each range consists of 6 consecutive cells). The first range in the series is C9:H9. 3 cells are then skipped and the process is repeated with the next range, ie L9:Q9 then skip 3. The last range in the series of 16 is therefore EK9:EP9.
If the value of non blank cells = 2 in any of these 16 ranges then copy the contents of this range to C24:D24 in sheet " Record Form Games 3583". If C24:D24 is not empty copy these values to C25:C26.
If the value of non blank cells = 6 in any of these 16 ranges then copy the contents of this range to C22:H22 in sheet "Record Form Games 3583". If C22 is not empty copy these values to C23:H23.
The ranges colored yellow in the example workbook are the ones that need to be copied to the sheet Record Form Games 3583.
View 9 Replies
View Related
Aug 10, 2007
I want to use the Small function on a set of cells that are non-contiguous. But I know that the Small function only works on an array, which cannot contain cell references. Copying the cells to a contiguous range is not an option, as some of the cells I want referenced are generated on the fly in a Sumproduct function. Is there some alternative I could use? I can use the Min function to get the lowest value, as it allows for references, and the Max function to get the greatest, but what about those in between?
View 4 Replies
View Related
Aug 31, 2007
I am trying to have this loop go through colums of data and compare columns 3 and 4. Where there are differences, parts of the row are copied and pasted in a summary table.
My problem is the output to the summary table.
How do I control which cells in the row are copied? (I only want to copy columns 1, 3 & 4)
How do I control where the copied cells are pasted to?
Sub Change()
Dim r As Long
'Loop to Compare Values
For r = 4 To Cells(Rows.Count, 1).End(xlUp).Row
'Looks For Funds That Upgraded
If Cells(r, 4) < Cells(r, 3) Then
'Highlights the row
Cells(r, 1).Resize(1, 5).Interior.ColorIndex = 34
'Copies The Applicable Cell Over Into Column 7
Cells(Rows.Count, 7).End(xlUp).Offset(1) = Cells(r, 1)
'Places a note into column 5
Cells(r, 5) = "UPGRADE"
End If
If Cells(r, 4) > Cells(r, 3) Then
Cells(r, 1).Resize(1, 5).Interior.ColorIndex = 36
Cells(Rows.Count, 7).End(xlUp).Offset(1) = Cells(r, 1)
Cells(r, 5) = "DOWNGRADE"
End If
Next r
Columns("G:G").EntireColumn.AutoFit
End Sub
View 9 Replies
View Related
Jun 9, 2008
Consider the following range (in my case a PivotTable):A1:E7
I create a Named Ranges that corresponds to column 1:3 and 6 from the range above. i.e : A1:C7,E1:E7
I need to find out the number of columns of my range, this is because it can change in the future, and I have an offset formula needing this information.
When i type =columns(MyNameRange) it returns #REF! as there are 2 areas in my Named Ranges. I am expecting 4.
I have written the a VBA User Defined Function that does the job, but I would like to know if there is no native solution to get this information.
Function TotColumns(rng As Range)
Dim Cols As Integer
For Each Ar In rng.Areas
Cols = Cols + Ar.Columns.Count
Next
TotColumns = Cols
End Function
View 7 Replies
View Related
Aug 5, 2008
I am building a macro to conditionally edit cells that meet certain criteria within the current selection:
Dim FinalStr As String
If CheckBox3.Value = True Then
For Each cell In Selection
If cell.Font.ColorIndex = Range2.Font.ColorIndex Then
FinalStr = FinalStr & "," & StrConv(cell.Address, 1)
End If
Next
End If
FinalStr = Right(FinalStr, Len(FinalStr) - 1) 'To remove extra "," at the beginning
What I am getting from this macro is a string like "$I$27,$J$27,$E$28,$F$28" that I use later to edit that range, for instance
Range("$I$27,$J$27,$E$28,$F$28").ClearContents
It worked fine, however, I found later that XL cannot handle more than 20-30 individual cell addresses. The error msg I am getting is: " Method 'Range' of object '_Global' failed " Note that it won't be very practical to pick the cells and edit them within the same loop since there are several criteria times several edit options.
View 9 Replies
View Related
May 7, 2009
I'm trying to select a contiguous range of cells in a column and then iterate over that. I keep getting error "91", object variable not set. I have:
View 5 Replies
View Related
Jun 29, 2012
I have several tables on one sheet, each of which has a Grand Total value at the bottom right of the summed data range
I have manually selected (using ctrl + left mouse click) each Grand Total cell and defined all these cells as a Named Range called Grand_Totals
I thought it would be possible to reference each of the cells in the Grand_Totals range individually.
The =Index function works fine if the data is contiguous but I can't figure out how to get anything other than the first element of the Grand_Totals range
So for example
Lets say the cells of the Grand_Totals non-contiguous named range are F10,N10,F30,N30,F50,N50
How would I reference the third element/cell (F30) in this range. I should point out that I actually need to reference all the cells in the Grand_Totals range and the range has a lot more than 6 cells
View 5 Replies
View Related