SUMIF based on two criteria?

I'm working on a spreadsheet which contains one table showing expenses over the course of a year. Each row contains a description, category, date and cost. Having read through the forums here I have managed to create a separate table that shows me running totals for each category.
Now I want to make one more table that will show me a monthly breakdown. I have a column for every month with the expense categories in each row. I want the formula to look at the first table and find all of a given category of expenses that occurred in one month.
It seems to follow that I could add an AND to the test in a SUMIF but it doesn't work. Any ideas?

imagecircus,
I have a solution but it may be more work than you're willing to put into this project. First of all, as already pointed out, SUMIF() does not support compound conditions. To get around this, a column (formula: =MONTH(C2)&B2) combining these conditions can be added to the Expenses Table as shown in the example.
The layout of the Breakdown Table is self explanatory and the basic formula in the cells is:
=SUMIF(Expenses ::$'Month & Category',“1Rent”,Expenses :: $Cost)
Now the not-so-easy part. This formula cannot be copied down or across without editing. Each cell must be edited individually to change "1Rent" to the proper Month/Category for that cell. Some careful copying across and down will limit the amount of editing required, but it is time consuming, tedious, and error prone. Only you can decide if it's worth the effort.
pw

Similar Messages

  • Totals Based on Multiple Criteria in Repeating Rows

    Hi All,
    I have 3 dropdowns (DD1, DD2, DD3) and one textfield (TF1) in repeating rows (not in a table).  Each dropdown has two choices and the textfield is free-form. Outside of the rows (in a different subform) I want totals based on multiple criteria from the dropdowns and textfields.
    The following script works great to get a total number of one choice from one dropdown.
    this.rawValue = xfa.resolveNodes('form1.Form.row[*].DD1.[$.rawValue == "2"]').length;
    Problem is how do I calculate the totals for the following based on the criteria listed in each row.
    Find the totals for ML
    Number of New Forms 1-2 Pages: (result should be 2)
    Number of New Forms 3+ Pages: (result should be 1)
    Number of Revised Form: (result should be 0)
    In row #1:  select “New” as a choice from DD1, “Form” as choice from DD2, “ML” as a choice from DD3 and enter “5” in TF1.
    In row #2:  select “New” as a choice from DD1, “Form” as choice from DD2 , “ML” as a choice from DD3 and enter “1” in TF1.
    In row #3:  select “New” as a choice from DD1, “Form” as choice from DD2, “ML” as a choice from DD3 and enter “2” in TF1.
    In row #4:  select “Revised” as a choice from DD1, “Series” as choice from DD2, “ML” as a choice from DD3 and enter “1” in TF1.
    In row #5:  select “New” as a choice from DD1, “Form” as choice from DD2, “PM” as a choice from DD3 and enter “1” in TF1.

    Try something like;
    var mlNewForms1or2Pages = 0;
    var mlNewFormsOver3Pages = 0;
    var mlRevisedForms = 0;
    var rows = xfa.resolveNodes('form1.Form.row[*]');
    for (var i = 0, limit = rows.length; i < limit; i++)
    var currentRow = rows.item(i);
    if (currentRow.DD1.rawValue == "1") // new
      if (currentRow.DD2.rawValue == "1") // form
       if (currentRow.DD3.rawValue == "1") // ML
        if (parseInt(currentRow.TF1.rawValue, 10) > 2)
         mlNewFormsOver3Pages++;
        else
         mlNewForms1or2Pages++;
    else // revised
      if (currentRow.DD2.rawValue == "1") // form
       if (currentRow.DD3.rawValue == "1") // ML
        mlRevisedForms++
    console.println(mlNewForms1or2Pages);
    console.println(mlNewFormsOver3Pages);
    console.println(mlRevisedForms);
    To do the same using predicates you could do;
    var mlNewForms1or2Pages = 0;
    var mlNewFormsOver3Pages = 0;
    var mlRevisedForms = 0;
    mlNewForms1or2Pages = xfa.resolveNodes('form1.Form.row.[DD1 == 1 and DD2 == 1 and DD3 == 1 and TF1 <= 2]').length;
    mlNewFormsOver3Pages = xfa.resolveNodes('form1.Form.row.[DD1 == 1 and DD2 == 1 and DD3 == 1 and TF1 > 2]').length;
    mlRevisedForms = xfa.resolveNodes('form1.Form.row.[DD1 == 2 and DD2 == 1 and DD3 == 1]').length;
    But if you wanted totals for all the permutations then this could become slow.
    Regards
    Bruce

  • How to implement paging in webdynpro jave based on search criteria.

    Hi All,
    In a requirement I need to implement paging in webdynpro java development.
    I successfully did it when there is no search criteria is available i.e webdynpro fetched all data from the BO object and I did it using a "indexNO" (unique serial no from 1,2,3,4.....) field available in BO object.
    But when there is search criteria available , i.e the data to be fetched from the BO based on some specific field , at that time the "indexNo"  field of all data fetched based on search criteria are discrete i.e not continious. In that case how to implement the paging concept.
    I am using CE version 7.1 EHP 1.
    Thanks in advance
    Srikanta Satapathy

    Hi,
    If you go to your VO and generate the ViewObjectImpl, in there you can create a method which will contain two parameters, 1 the attribute name and 2 the value.
    Then you can follow something like explained in this post:
    ADF Tutorial: How to apply bulk actions to a view object rows
    The only difference is that you will need to create a method like this:
    public void updateAttribute(String attribute, Integer value){
            RowSetIterator iter = createRowSetIterator(null);
            while (iter.hasNext()){
                Row row = iter.next();
                row.setAttribute(attribute, value);
    Then you expose that as a client interface and then after you filter your table by your criteria you just need to execute this method passing the right parameters.
    Regards

  • Returning Different Results Based on Input Criteria

    I have a complex nested select statement. Based on selection criteria I want to return different results. Say for instance I had an input parameter Called Products which could contain a Yes/No Flag. If the Flag was Yes then I would want the "top" select, statement to be The following:
    Select Product, Time_ID, Amt
    From
    My Complex Nested Select
    But if Product was set to "No", I would want the following:
    Select Time_ID, Amt
    From
    My Complex Nested Select
    I know, or course that I can have two COMPLETE set of SQL which are invoked based upon testing the value of the PRODUCT Parameter, but If I duplicate the "inner nested select" then I have 2 sets of select staments to maintain. Is there an alternative to this? Could I make the inner portion which does not change a function of some sort so that my code would look something like this?
    Select Product, Time_ID, Amt
    From
    Execute myNestedSelectFunction
    But if Product was set to "No", I would want the following:
    Select Time_ID, Amt
    From
    Execute myNestedSelectFunction
    This would atleast ensure that I only have to go one place to maintain the logic of the "static Nested Select" statement.
    Just want to make sure I do not have a real viable alternative to "duplicating code"
    Thanks

    Hi,
    Look in TFM for PIPELINED functions which will allow you to:SELECT Product, Time_ID, Amt FROM TABLE(myPipelinedFunctionReturningSelectResult()) T;
    SELECT Time_ID, Amt FROM TABLE(myPipelinedFunctionReturningSelectResult()) T;There are samples if you look on AskTom too.
    Regards,
    Yoann.

  • Unable to filter a formula field based on two conditions

    hi,
    I have a report with 3 subreports in it. When i drill down onto first subreport i am getting correct records in details based on selection criteria but when i am unable to populate the same record count in summary.
    For example
    On summary i see : 60 when i drill down i see 20 records which is correct but not reflecting onto summary report
    the details selection criteria is based on two  fields where field1>=1 and field2= "Text"It is coming out good (20 records) but in summary i am unable to populate this based on same selection criteria
    The main issue i am facing was if i apply a filter on summary selection criteria all the subreport counts are getting affected. Is there a way i can apply filters only one one field
    Please suggest
    Thanks!
    Lucky

    Thanks! for the prompt response Abhilash
    I got part of what you told me. Yes i am calculating the counts in the summary report.
    Basically here is the selection criteria: i need to filter the records based on two conditions. One is x.field1= "Admin" and x.field2=act_pct>=1
    For example:
    Admin Returns         50  but when i dig into details it showing as 20 records ( based on selection criteira above)
    when coming back to summary . 50 what ever is returing here is based on a formula ( if x.field1="admin" then 1 else 0) ..in addition to this i need to filter that by x.field2>=1 which is not taking it     
    Is there any syntax to do this
    If i apply a filter on this particular 50 record its bee applying for whole summary report ...
    And from what you said :
    Why don't you create the summary in the Subreport and maybe use shared variables to bring it back to the Main Report?
    i did not get this
    Please suggest
    Lucky

  • Can we create a hierarchy based on two logical table in 10g RPD

    Hi,
    I have a question, please give me some clarity, about creating hierarchy,
    I know we can create a hierarchy based on one logical table which is form by two physical table...
    Can we create a hierarchy based on two logical table? If yes, and how?
    Thanks in advance!
    anne

    Use preffered drill paths...
    -suman

  • Select One Choice attribute' LoV based on two bind variables, best practice

    Hello there,
    I am in the process of learning the ADF 11g, I have following requirement,
    A page must contain a list of school names which is needed to be fetched based on two parameters, the parameters are student information been inserted in the previous page.
    I have defined a read only view "SchoolNamesViewRO", it's query depends on two bind variables :stdDegree and stdCateg.
    added that RO View as a view accessor to the entity to which the name attribute belongs, and then add LoV for the name attribute using the ReadOnly view,
    added the name attribute as Select One Choice to page2,
    and now I need to pass the values of the bind variables of the ReadOnly view,
    the information needed to be passed as the bind variables is inserted in the previous page, I could have the data as bindings attribute values in the page2 definition
    I have implemented the next two appraoches but both resulted in an empty list :
    * added ExecuteWithParams Action to the bindings of the page and then defined an Invoke Action (set refresh condition) in the executable s, set the default values of the parameters to be the attributes values' input value,
    in the trace I code see that the binding fetches correct values as supposed , but the select list appears empty, does the this execution for the query considered to be connected to the list ?
    * added a method to the ReadOnly view Imp java class to set the bind variables, then I define it as a MethodAction in the bindings , and then create an Invoke action for it , also the select is empty,
    if the query been executed with the passed variables, then why the list is empty? is it reading data from another place than the page!
    and what is the best practice to implement that requirement?
    would the solution be : by setting the default value of the bind variables to be some kind of Expression!
    please notice that query execution had the bound variables ( I see in the trace) are set to the correct values.
    would you give some hints or redirect me to a useful link,
    Thanks in advance
    Regards,

    please give me any example using backing bean .for example
    <?xml version='1.0' encoding='UTF-8'?>
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
    <jsp:directive.page contentType="text/html;charset=UTF-8"/>
    <f:view>
    <af:document id="d1">
    <af:form id="f1">
    <af:selectOneChoice label="Label 1" id="soc1" binding="#{Af.l1}"
    autoSubmit="true">
    <af:selectItem label="A" value="1" id="si1"/>
    <af:selectItem label="B" value="2" id="si2"/>
    </af:selectOneChoice>
    <af:selectOneChoice label="Label 2" id="soc2" disabled="#{Af.l1=='2'}"
    partialTriggers="soc1">
    <af:selectItem label="C" value="3" id="si3"/>
    <af:selectItem label="D" value="4" id="si4"/>
    </af:selectOneChoice>
    </af:form>
    </af:document>
    </f:view>
    </jsp:root>
    package a;
    import oracle.adf.view.rich.component.rich.input.RichSelectOneChoice;
    public class A {
    private RichSelectOneChoice l1;
    public A() {
    public void setL1(RichSelectOneChoice l1) {
    this.l1 = l1;
    public RichSelectOneChoice getL1() {
    return l1;
    is there any mistake

  • Query based on two views

    Hello ppl, I need your help.
    I got this query which is based on two views.
    View_1: x1, x2, x3, x4, day, xy
    View_2: y1, y2, y3, y4, day, xy
    By running a SELECT query on each view takes approx 2 minutes, yes there are lots of records.
    When I combine the query most of the time it times out. I think there is something wrong with my query.
    View_1 = View_2 on col xy and day, however I have to get the records from View_2 for the following day, i.e if day = 3 from View_1 and the record from View_2 should be coming from view_2
    at present my query is like this
    SELECT a.x1, a.x2, a.x3, a.x4, a.day, a.xy, b.y1, b.y2
    FROM view_1 a, view_2 b
    WHERE b.y2= 100
    AND a.xy = b.xy
    AND b.y1 = ( SELECT b.y1
    FROM view_1 a, view_2 b
    WHERE b.day = a.day + 1)
    ORDER BY a.x1
    This query gets called in a coldfusion page.
    P.S I can also ask the DBA to make me a new view based on the same columns as the query. Would that help with speed?

    I don't see any reason why my query shouldn't give
    you what you desire.
    View_1
    x1     x2     x3     x4     Day     XY
    2      3      23      32      3      2132
    3      3      2      3      4      2132
    4      3      43      32      5      2132
    View_2
    y1     y2     y3     y4     Day     XY
    4      100      13      32      3      2132
    5      100      4      3      4      2132
    7      100      43      32      5      2132
    5      100      23      12      6      2132
    Is it a coincidence that XY has the same value in your sample? Could it be different
    and at the same time participate in the desired result?
    SELECT     a.x1, a.x2, a.x3, a.x4, a.day, a.xy, b.y1, b.y2
    FROM     view_1 a
    ,     view_2 b
    WHERE     b.y2 = 100
    AND     a.xy = b.xy
    AND     b.day = a.day + 1
    ORDER BY a.x1
    >
    X1     X2     X3     X4     Day     XY     y1     y2
    2      3      23     32      3      2132      5      100
    3      3      2      3      4      2132      7      100
    4      3      43     32      5      2132      5      100
    According to the reply to my question above, it can be ok or not.
    That is why I proposd this (in case the reply were yes):
    SELECT a.x1, a.x2, a.x3, a.x4, a.day, a.xy, b.y1, b.y2
    FROM view_1 a, view_2 b, vew_1 c
    WHERE b.y2= 100
    AND a.xy = b.xy
    AND b.day = c.day + 1
    ORDER BY a.x1

  • Calculate difference in value based on two date parameters

    Hi All,
    I have a table and need to calculate the difference in rent amount for a property based on two date parameters.
    I have uploaded sample data here:
    https://app.box.com/s/pu8oa4f3jhrhm0ylshdz2fuo7541vn4z
    Thanks
    Jag

    Hi jaggy99,
    Do you have the knowledge of
    Excel Add-In? If you don't have knowledge of C#/VB.NET language and Visual Studio, I don't think Excel Add-In is what you want. As I said previously, your problem is totally about the business logic, we don't provide solution for a complete requirement.
    Based on your sample data, I think VBA code is suitable.
    If you're not familiar with VBA, please take a look at the MSDN documents for scratch:
    Getting Started with VBA in Excel 2010
    The steps should be like this:
    1. Sort all the records by [Rent Change Date] field
    2. Loop throuth the records and find the FromDate and ToDate as well as the corresponding [Rent Charged] field
    3. Calculate the difference and save the data into a new range
    It's not so hard, please have a try, if you encounter any development problems, you can post in this forum.
    Thanks.
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Calculation based on two result columns in combined report

    Hi all - I have a combined analysis and I need to add a result column based on two of my result columns. The calculation involves one column from my first report and one column from my second report.
    The first report has # of opportunities and my second report has a number of booked opportunities. I have to have two separate reports because these two columns need to be filtered on different dates. In my result column, I want to add a column that gives me close % which is # of booked opps/# of opps. I am using the SAW references but it is not working right. I have tried the following calculations:
    (SUM(SAW_9 BY SAW_1) / SUM(SAW_7 BY SAW_1))*100 This gives me 100% in any row that is 1 opp to 1 booked opp. But gives me 0 in all the other fields even if it is 2 opps to 1 booked opp.
    (MAX(SAW_9 BY SAW_1) / MAX(SAW_7 BY SAW_1))*100 This shows 100% for every row that has a number in the opp and booked opp columns. Even shows 100% if it is 2 opps to 1 booked opp which should be 50%.
    Any ideas on what formula I need to use to get the right calculation?
    Thanks!
    Lacey

    Lacey,
    (SUM(SAW_9 BY SAW_1) / SUM(SAW_7 BY SAW_1))*100 is the correct formula so the only thing I can think of is do you have the correct columns selected?
    SAW_9 is column 10 and SAW_1 is column 2?
    and I think the aggregation rule needs to be sum as well.
    Good Luck
    Alex
    PS thanks to Mike Lairson for putting this solution in his book as it got me working.

  • Drill down in report based on two queries

    Hi,
    I have a problem with drilling down in report which is based on two queries.
    Queries are based on different universes.
    Both queries contains almost the same dimensions but different measures.
    In my report is a calculated measure based on measures from both queries.
    In both universes are the same hierachies.
    When I drill down in report for the first time I have to chose hierarchy  but then data are filtered to the choosen  value only from one query , data from second query are not filtered and the values of calculated measure are incorrect
    How can I solve this issue without adding dimensions belonging to the hierarchies to queries.
    Please help.
    Regards.
    MG

    Hi MG,
    First of all, what do you mean by "Both queries contains almost the same dimensions but different measures"
    "Almost" is not a good word in the IT world, especially when trying to merge/join tables. You need to be exact.
    That sounds like a possible reason for the problem.
    I am also not sure about your question:
    "How can I solve this issue without adding dimensions belonging to the hierarchies to queries."
    You may have to add those dimensions to the queries. Why would you not want to?
    Thanks

  • Person DFF Context Value based on 2 criteria (Business Group and Emp Type)?

    Hello,
    We're implementing HR module into multiple business groups.
    I need to define context value for DFF "Additional Personal Details" based on 2 criteria Business Group ID and Employee Type
    Any idea how to do it?
    Thank you
    Elie

    Hello Elie,
    I am not sure on it,However have you tried creating a context with combination of Business Group and Person Type using merging,
    business_group_id || "_"|| person_type_id And structures would be something like 80_2112 Business Group id = 80 and Person Type id=2112.
    It may resolve your issue if this works out.
    Regards,
    Saurabh

  • Update column based on two columns

    Hi,
    MinValue     MaxValue    Desc
    -1                -1    
    -1                 1    
    -1                 2    
    0                  0    
    0                  1    
    0                  2 
    The above is my table which is having three columns MinValue, MaxValue, Desc. First two columns have data and I need to update the 3rd column 'Desc' based on two columns data.
    I need to update like,
    when MinValue=-1 and MaxValue=-1 then 'NotSpecified'
    when MinValue=-1 and MaxValue=1 then 'Up to 1'
    when MinValue=-1 and MaxValue=2 then 'Upto 2'
    when MinValue=0 and MaxValue=1 then 'At lest 1'
    when MinValue=0 and MaxValue=2 then 'At least 2'
    when MinValue=0 and MaxValue=3 then 'At least 3'
    The data in 'MaxValue' is like 1,2,3,4,5...50. So for each description it should append this value as mentioned above(till 'Up to 50', 'At least 50'). How can I do this with case statement?
    Thanks,
    Gangadhar

    declare @T table ( MinValue int,MaxValue int, [Desc] nvarchar(100) );
    insert @T ( MinValue, MaxValue )
    values ( -1, 1 ) , ( -1, 1 ) , ( -1, 2), ( 0, 0), ( 0, 1), ( 0, 2)
    select *
    from @T
    update @T
    set [Desc] = case
    when MinValue=-1 and MaxValue=-1 then 'NotSpecified'
    when MinValue=-1 and MaxValue=1 then 'Up to 1'
    when MinValue=-1 and MaxValue=2 then 'Upto 2'
    when MinValue=0 and MaxValue=1 then 'At lest 1'
    when MinValue=0 and MaxValue=2 then 'At least 2'
    when MinValue=0 and MaxValue=3 then 'At least 3'
    end
    select *
    from @T
    T-SQL Articles
    T-SQL e-book by TechNet Wiki Community
    T-SQL blog

  • Sorting based on two columns in report

    Hi,
    we have one issue on sorting based on two columns in report.
    In the report we are doing sorting on two columns(week_id and stage_name). I have attached the screen shot for the same. The sorting is first done on the week_id and then on the stage_name. The issue comes when we have no data for the stage 1 - Prospect in W1. The stage goes to the second position.
    Please suggest if there is any work around to show the 1 - Prospect stage in W1.
    Regards,
    Ambika Nanda.

    what is w1? where is screenshot? and is stage seoncd sort? if so what is the issue?

  • BLOCK BASED ON TWO TABLES

    I've created a block based on two tables.
    Querying records works fine.
    However, when I try to amend a column in the master table I get an error message 'Record has already been updated by another user.'
    I have set the dml target property to to the master table and set the primary key on the correct columns.
    What else could there be??!!

    Block1 will be----- enter_query Sku :123 then from dropdown select Level 1 which will show data like this
    in two different rows.
    Sku       : 123       Price  : $100        Qty : 10   (Primary)
    Sub Sku   : 345       Price  : $110        Qty : 8   (Level 1)then from dropdown selected Level 2 which will show data like this in two different rows.
    Sku       : 123       Price  : $100        Qty : 10   (Primary)
    Sub Sku   : 456       Price  : $90         Qty : 12 (Level 2)There are two more blocks which will display more information based on either Level 1 is selected or Level2 selected.
    Regards
    Sandy

Maybe you are looking for

  • Any known issue about running Swing application in WTS?

    *{color:#0000ff}Is there any known issue about running Swing Application in Windows Terminal Server?{color}* It is started using JWS from internet (I mean, it checks if there is an avaiable update and updates or just fun). _*{color:#800000}+The probl

  • Resolve self-reference table by alias tables in detail

    Hello Gurus,         can you tell me how to resolve self-reference table by alias tables in detail? Many thanks.

  • DNG Converter no longer converts focusing points from Canon CR2 files

    Hi all, Up until some time between July 2010 and September 2010, the focusing points embedded in the original Canon CR2 files were also converted and containded in the DNG-file. Hence up until this point in time the focusing points were shown in Appl

  • Compound boolean logic scripting

    Greetings!  I would like to pick everyone's brains for how one might implement compound boolean logic scripting in LabVIEW ... specifically LabVIEW-RT. My application is an in-vehicle data acquistion and logging setup.  The app is setup so that the u

  • DP Local Key Figure Discrepancy between Aggregated level and lowest level

    Dear, Here is my issue. Forecast (key figure) Life Cycle Factor (key figure) Final Forecast (Local Key figure) Final forecast = Forecast * (1- LCF (%) ) Example : Product 1 = 100 Product 2 = 200 Product 3 = 300 TOTAL FORECAST = 600 If I assign a life