Dsum With Variable Criteria

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


ADVERTISEMENT

DSum Criteria ..

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

Dsum For 2 Different Criteria

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

DSUM Adjacent Criteria

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

Dsum On Multiple Criteria

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

Dsum Based On Multiple Criteria

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

DSUM When Criteria Field Is Blank

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

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 View Related

DSUM Multiple Criteria - Return Data

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

DSUM Formula With Varying Criteria Across Report Matrix

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

Dsum Or SumIf

Nov 17, 2006

I'm trying to keep a running total (in one cell) for a range of cells
(see below).

The cells in the range consist of two columns- account number and an
amount. Given that the account numbers range from those beginning with
2XXX, 3XXX and 4XXX. The running total should be derived from the
totals associated to accounts beginning with 2XXX and 4XXX.

First attempt using pivot tables doesn't work since the amount column
is dynamic and thus is changed by user input - pivot tables would need
to be refreshed regularly which isn't possible. My goal is to have
this running total also be dynamic and performed automatically.

Second attempt using SUMIf doesn't work because the 'criteria' also
changes and isn't statis; the criteria in this case would be moving
with each row of data.

Third attempt using DSUM doesn't work b/c I can't seem to get the
syntax correct.

Account Original Budget
535030 24,600.00
535030 -
535036 36,900.00
535037 -
247695 -
258804 17,936.10 ..........

View 9 Replies View Related

DSUM Function

Nov 10, 2003

I am trying to convert the following Lotus .123 function into an excel function:

@IF(@DSUM($QUERY,"TOTAL EST LBS",(((TEXT WEIGHT=50)#OR#(TEXT WEIGHT=50))#AND#GRADE NBR=20#AND#@MONTH(MFG MTH)

View 9 Replies View Related

DSUM Date Ranges

Apr 14, 2009

I an having trouble with DSUM, the result I get is 0. I have a Journal Entry and I need to total the amount for a particular range date.

For the header I have:
Date|Account|Debit|Credit|Total|Account Name|Description

This is located from A5:G21

For A1:C2 I have Account|Date Start|Date End
For both Date I used the formula =">="&TEXT(E2,"mm/dd/yyyy") and the same for the ending date which is ="

View 9 Replies View Related

Sumif V Dsum V Sumproduct

May 2, 2007

I am using the SUMIF formula to sum all the cells that meet a certain criteria and at the moment, this works fine. Now I want to extend the criteria to 2(3 later) conditions. I've read that the SUMIF function only handles 1 criteria. Is this correct? If so should I use SUMPRODUCT or DSUM? I eventually will have to check about 2000 cells in a workbook. Sample work book attached: where I need to total the price of all the items that are shoes and are red in colour. A pivot table beckons in the future, but for now I need this in a workbook format.

View 3 Replies View Related

Convert Sumproduct To DSUM

Jul 17, 2007

What would be the correct syntax to convert this sumproduct formula to a dsum formula
I can't seem to find any examples that match my exact need

=SUMPRODUCT((Data!$A$2:$A$15998=$B$3)*(Data!$C$2:$C$15998=$A14)*(Data!$E$2:$E$15998=B$10)*(Data!$D$2:$D$15998))

View 7 Replies View Related

Not Sure To Use Dsum Or Vlookup For Multiple Searches

Feb 27, 2009

I would like to ask recommendations whether to use DSum or Vlookup, in order to do multiple search.

We receive a flat file on a daily basis, which contains four (4) columns. They are Group, Team, Taskname, and Number_of_Employees. The first three columns have text properties and the last one has number property. We copy this sheet into our workbook. There are more than 1,000 rows. I name this tab, "TotalWorkersbyTask".

Each group (first column) has its own tab. We try our best to name each tab to match the name of the first column.

We would like to find the unique value, in order to put the correct Number_Of_Employees into the correct column on each sheet. However, the relationship per column is many to many, which makes it more difficult.

For example,

Group,Team, TaskName, Number_of_Employees

12GR, Robert, Analyze raw data, 2.5
12OV, Tim, Analyze raw data, 1.25
12OV, Bob, Prepare reports, .85
16CJ, Jim, Prepare reports, .50
1008, Mary, Analyze raw data, .25
............

Each tab, such as 12GR, will have the task name on the line "Analyze raw Data" which matches the information "TotalWorkersbyTask" tab.

The problem is, if I do a Vlookup for Taskname only, only the first value of 2.5 will return in to the Number_of_Employees column.

For the tab of group 12GR, the logic supposes to be -> if the group is 12GR, and the name of the task equal to the one appeared in "TotalWorkersbyTask", return me the value of 2.5 in the specific row. With the same logic, on the tab 12OV, the same task name should return me the value of 1.25 as well.

As you see from the example, line 2 and line 3 are the tasks in the same tab, from the flat file received.

Then, this formula can be copied and populated into other rows and other sheets as well.

*********************
Questions:

1. Is there anyway to write the formula to gather the required information? My thought was using the Vlookup. However, it can see only one column.

2. Do I need to rename all the tabs to match the name of the first column received from flat file in order to make it more efficient? (In the present, there are some tabs that match the name, such as 12OV, and some tabs are something like ->Engineering, Research, etc.)

View 9 Replies View Related

Write DSUM Which Calculate Only The Latest 15 Times?

Dec 27, 2013

I'm placing dsum on a table, and want to sum some criteria I've wrote, all I need is the sum of the 15 latest match of the event I've wrote - which needs to be Sum together , I can use "helping column" in the table, but is there is more elegant way to do this with a furmula which make dsum calculate only the latest 15 cases ?

View 1 Replies View Related

DSUM Function To Pull In Data From Another Worksheet

Oct 6, 2008

I've been using the DSUM function to pull in data from another worksheet.

In brief, the problem is that when I Cut & Paste the formula from C7 to C8, I want the Column reference to change but not the Row reference.

If I copy across the Columns then the result is OK – e.g. The Formula will change from…

#=DSUM([HBAP_SHUTDOWNS_2008.xls]NWM_SuccessfulShutdownsByDepartment!$A$4:$E$2924,"Total",'Calculations Page'!A$17:A$18)#

To…

#=DSUM([HBAP_SHUTDOWNS_2008.xls]NWM_SuccessfulShutdownsByDepartment!$A$4:$E$2924,"Total",'Calculations Page'!B$17:B$18)#.........................

View 4 Replies View Related

VBA For Variable Filtering Criteria

Jan 15, 2014

I have a data set in Excel that starts with row 13 and has 26 columns. The headers are in row 12.

A pop-up user form requires the user to select from a drop down menu i.e Top50, Top100, Top200...

Once this is selected, the script below applies a filter to the header row & filters Column O based on the Topxxx chosen in the user form.

The script then selects the visible cells in selected columns from the data set and copies these to another sheet.

The only thing that changes is the filter criteria i.e the user-defined choice of Topxxx from the user form.

Obviously I would like to try and avoid having to copy copious lines of coding for each filter criteria i.e Top50, Top100 etc etc.

Code:
If UserForm1.ComboBox2 = "Top50" Then
Sheets("MD14").Activate
A9 = ActiveSheet.Range("A9").Value 'Counta
ActiveSheet.Range("A12:Z12").Select
Selection.AutoFilter

[Code] ........

View 1 Replies View Related

Autofilter With Variable Criteria

May 16, 2006

I'm actually trying to write a Macro that applies autofilters and the information just doesn't show! The autofilter is properly applied and everything, but the only visible row is the header. The code is the following.

mes = Month([M2])
filfecha = Range("M2").Text
Columns("E").AutoFit
Rows("1:1").Select
Selection.AutoFilter
Selection.AutoFilter Field:=5, Criteria1:=filfecha

View 2 Replies View Related

Exact Criteria In 2-variable Table

Jun 26, 2009

This is probably so simple for an Excel wiz, but I've drawn a blank.
I have a 2-axis table, with the formula =DCOUNTA(Data,"Function",B15:C16) in the top left intersect cell. Data range is the table of info, which has location and function column. Location has values UK and Ukraine.............yes, you've guessed it, the UK row of the table returns both UK and Ukraine numbers.
The criteria range B15:c16 has Function and Location as headings and blanks underneath. The data table references B16 and c16 as the row and column variables.
How can you modify the criteria or table formula not to use starting-with criteria but exact matches ? (probably have to use another formula besides an array version of dcounta, right ?)

View 9 Replies View Related

Sumif Several Sheets And Using A Variable Criteria Range

Oct 23, 2008

Currently I’m using several formulas to acquire my result; I know it can be abbreviated to a more compact formula.

I have four Sheets. One summary sheet and SheetA, SheetB and SheetC containing Data.
All sheets are documented in an equal format, e.g.: in column A: Date, column B: Code (A, B, C or D) and Column C: values.

Criteria are located in the summary sheet e.g.: A2: 1-1-2008 A3: 2-1-2008 and B2: A, B3:B
The data sheets are listed in H1:H3.

The results should cover a sum of col C over the sheets by using the critiria listed in summary sheet.

The criteria range is variable; sometimes I only want to use one criteria and sometimes more.

View 9 Replies View Related

Sum Values If Multiple Variable Criteria Are True

May 13, 2008

I'm trying to find the sum of a range of values based on multiple criteria, and the criteria is that the fields all have to be identical, then sum them. I've attached a brief example spreadsheet that has the fields

A=City
B=State
C=Values

What I want the formula to do is first find the range of all the matching states, then find the range of all the matching Cities within the states, and then sum the values based on them having matching city values.

I've been able to do that with one criteria using SumIf, I'm not sure if this will help paint an image of what I want to do:

=ROUND(SUMIF($B$3:$B$11,$B$3:$B$11,$C$3:$C$11),0)

But I can't figure out the way to do multiple criteria against itself. Most of the results I get from Google using multiple criteria are using a set few values, and I can't seem to figure out how to alter those methods to work with my situation.

View 9 Replies View Related

Date Conversion And Use A Variable Of Type Long As A Search Criteria

Jul 22, 2008

How to assign a variable of type Long to the below code.

1) Dim searchField as LOng
ActiveSheet.Range("N2").FormulaArray = "=MAX(IF($A$2:$A$200=""" & searchField & """,$C$2:C$200))"

2) ActiveSheet.Range("N2").FormulaArray = "=MAX(IF($A$2:$A$200= searchField,$C$2:C$200))"
1) code failed because I want the variable searchField to have a data type of LONG.

2) code failed because it seems like excel thought the search criteria is of same searchField.

How to convert date to general format and store it in a variable of data type Long. I.E if I convert 3/15/2008(data type of Date) to data type of General, it should be 39522. What is the VBA code for doing this conversion?

View 9 Replies View Related

Calculate A Multi-variable Equation Based Off Of Data In A Table With Different Criteria

Jan 8, 2010

I'm trying to calculate a multi-variable equation based off of data in a table with different criteria. If you reference the attached spreadsheet I am trying to calculate cost based on weight and zone. For the data entered in cells B1 and B2 944.01 would be the cost. If you look at the table in G2:N3 you'll notice that the values in G2 and G3 are the weight limits G2 is from 0-4999 and G3 is 5000+, this should impact where the value in B1 falls. B2 should select from H1 to N1.

View 3 Replies View Related

To Merge Variable Number Of Cells Into One Single Cell Based On Criteria

Sep 19, 2009

Here’s an example of my data:

A B
1110AAAAAAA
2220BBBBBBBB
3330CCCCCCCC
4330DDDDDDD
5330EEEEEEEEE
6440FFFFFFFFF
7440GGGGGGG
8550HHHHHHH

I need your help to figure out how to merge the above data to look like this in new blank worksheet using a VBA macro:

A B
1110AAAAAAA
2220BBBBBBBB
3330CCCCCCCC
DDDDDDD
EEEEEEEE
4440FFFFFFFFF
GGGGGGG
5550HHHHHHH

View 10 Replies View Related

VB Macro For Variable Cell Merge Into HTML Code Based On Criteria

Oct 7, 2009

Does anyone have a VB macro that will copy information from a cell (this will be variable based on criteria) and paste it into the middle of another cell that contains HTML code?

The criteria for the copy/insert/paste is that the information in the cell that is to be copy/inserted must match up with the correct number (part number).

I hope this makes sense. I have attached an example spreadsheet. (Pictures are worth 1000 words. ) Hope someone can help. I checked this site and couldn't find anything that was solved that matched the specifics.

View 6 Replies View Related

Multiple Options Cell Values Based On Multiple Criteria Variable Inputs?

Mar 18, 2013

I maintain the data flow at my work. We send and receive the data using excel files with specific formatting that I then upload to the database. Each time I send or receive the excel file I must log them, this is what my code question refers to.

I use RDBMerge to merge all the contents of the 100 plus excel files into one worksheet. The first part of the macro cleans up the merge data for use in the log (i have attached an example of the clean data and finished log).

The blue shaded area of the "Raw_Data" is what the clean data looks like, the yellow column is what current macro records for each record.

As you can see by the example the Raw_Data is only two files LL_LLL_BOB_ToLLLLL_20121228_01 & LL_LLL_BOB_ToLLLLL_20121230_01, each with more that one record.

The log code in column "H" Is based on this criteria:
First Letter of the Unique ID in column "E" - O, M, or L
Program Type in Column "F" - U or R
1. O-U = U
2. O-R = RU
3. M-U = U2
4. M-R = R2U
5. L-R = R

You will note that Columns G-R of the "Log Sheet" correspond to the "Record Type" found in Column "G" of the "Raw_Data" sheet.

This is the area where my skill at using scripting dictionaries fails.

The results for the log list each file only once, but the log code for each corresponding "Record Type" in columns G-R of the "Log Sheet" must contain each unique instance of the code. In other words

if LL_LLL_BOB_ToLLLLL_20121228_01 contains an O-U with an "A" Record Type and an M-R with an "A" Record Type; then, on the log sheet there needs to be the codes "U/R2U" in the cell intersection of the LL_LLL_BOB_ToLLLLL_20121228_01 record row and "A" column (which is column "G")

So, If the File contains one of each code for each Record Type the corresponding cell must house one of each code separated by a "/" without any spaces. This means the cell value could no code, or one code and all the variations in between to all five codes. Also, for ease of human reading the log codes should be concatenated in the 1-5 order that I listed them in (U/RU/U2/R2U/R)

Here is my code so far.

VB:
Option Explicit
Sub test()
Dim dic As Object, a, i As Long, rng As Range, e, w, n As Long
Set dic = CreateObject("Scripting.Dictionary")

[Code].....

View 1 Replies View Related

DSUM Formula Instead SUMIF Formula

Dec 19, 2006

I come across a spreadsheet that is using DSUM formula, I did not understand why someone used DSUM instead of SUMIF formula, because using DSUM formula they had to use two extra cells for criteria, as seen in this example.
I like to know is there any advantage of using DSUM instead of SUMIF in this example.
The formule they used is =DSUM(J109:K113,2,$M$2:$M$3)
and the criteria is G,D
so they are adding all Debits in that column.
I changed the formula to =SUMIF($J$110:$J$113,"D",$K$110:$K$113)
that of course does not need $M$2:$M$3 range criteria.

G 3458224.37
D 3401317.50
C 3401317.50
C 56906.87
D 56906.87

View 9 Replies View Related

Set Variable: Object Variable Or With Block Variable Not Set

Jun 4, 2007

I have the following code (just pasting the relevant section) which crashes when it reaches the highlighted line of code. and a dialog box pops up with the text: "Object variable or With block variable not set"

Sub test()
Dim StartRng As Range
Dim Buffer As Range

Set StartRng = WorkSheets("Sheet1"),Cells(1,1)

StartRng.Activate
ActiveCell. CurrentRegion.Select

Buffer = rngStart.CurrentRegion.Copy

' I also tried the following line of code but that didn't work either
'Set Buffer = rngStart.CurrentRegion.Copy
..
...
End Sub

View 9 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved