+ Reply to Thread
Results 1 to 7 of 7

SUMIF function for 2 criteria

  1. #1
    Registered User
    Join Date
    04-08-2014
    Location
    Tuas, Singapore
    MS-Off Ver
    Excel 2003
    Posts
    3

    Question SUMIF function for 2 criteria

    Hi all, good afternoon.
    This is my table

    A1 A2 A3 A4
    1 Com Non C NA Date
    2 76 20 30 04-Apr
    3 126 05-Apr
    4 126 06-Apr


    The column A1 is where I am doing the calculation.
    I want the calculations to be done in A1. A1 should be 126 minus the sum of A2 and A3 HOWEVER
    I do NOT want the 126 to appear.

    I tried SUMIF(A2:a3,">1", 126-(A2+a3)) but this returns back error
    Is there a way to do this without having the 126 in that cell..?

    Thanks

  2. #2
    Forum Expert
    Join Date
    11-26-2013
    Location
    Colac, Victoria, Australia
    MS-Off Ver
    Excel 2016
    Posts
    1,309

    Re: SUMIF function for 2 criteria

    Welcome to the forum stoncul,

    Unfortunately, I can't work out what you are trying to achieve.

    The table does not fit your words.

    1 You have A1, A2, A3 A4 in your first row. Do you mean A B C D - are these Column Headings?

    2. The next row (1) has Com in the first position. This would be Cell A1. Therefore, I assume that you want to do something with 76, 126, and 126, but I can't work out what!!! Where do you want to do this calculation?

    You need to post a workbook so that your needs are clearer.

    Regards,

    David

    Please remember, your request is clearer if you attach a sample workbook.
    - Click on Go Advanced and click on the Paper Clip.
    When you reply please make it clear WHO you are responding to by mentioning their name.
    If this has been of assistance, please advise. A little thanks goes a long way.
    - Please click on the *Add Reputation button at the bottom of helpful responses.
    Please mark your thread as SOLVED:
    - Click Thread Tools above your first post, select "Mark your thread as Solved".

  3. #3
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: SUMIF function for 2 criteria

    So you essentially want:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    But you don't want the 126 to be visible?

    You could store the 126 value in a another cell, name the range, hide it, then refer to it:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    And / Or, you could set the cell properties to locked and hidden, and protect the worksheet.
    let Source = #table({"Question","Thread", "User"},{{"Answered","Mark Solved", "Add Reputation"}}) in Source

    If I give you Power Query (Get & Transform Data) code, and you don't know what to do with it, then CLICK HERE

    Walking the tightrope between genius and eejit...

  4. #4
    Registered User
    Join Date
    04-08-2014
    Location
    Tuas, Singapore
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: SUMIF function for 2 criteria

    David A Coop,
    I've attached the simple worksheet.


    2. The next row (1) has Com in the first position. This would be Cell A1. Therefore, I assume that you want to do something with 76, 126, and 126, but I can't work out what!!! Where do you want to do this calculation? Cell A1 is 76. Com is actually the column heading
    Attached Files Attached Files

  5. #5
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: SUMIF function for 2 criteria

    Think I understand you now. In A2, enter:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    and copy down.

  6. #6
    Registered User
    Join Date
    04-08-2014
    Location
    Tuas, Singapore
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: SUMIF function for 2 criteria

    Olly you are absolutely right!

    On a side note, is there a reference to which I can understand the code. I could have never figured that out

  7. #7
    Forum Expert
    Join Date
    11-26-2013
    Location
    Colac, Victoria, Australia
    MS-Off Ver
    Excel 2016
    Posts
    1,309

    Re: SUMIF function for 2 criteria

    Hi stonecut,

    I see Olly gave you the answer before I got back to the site!

    Olly's formula is using two functions - IF and AND. It is effectively saying if the cell in column B AND the cell in column C are empty (""), then the answer is empty. Otherwise, it is 126 minus whatever is in column B and C on this same row.

    I like Olly's suggestion in his earlier post to use a named variable MyTarget. It means that you can just change ONE cell if that target changes instead of multiple cells.

    I hope this helps, please let me know!

    Regards,

    David

    When you reply please make it clear WHO you are responding to by mentioning their name.

    If this has been of assistance, please advise. A little thanks goes a long way.
    - Please click on the *Add Reputation button at the bottom of helpful responses.

    Please mark your thread as SOLVED:
    - Click Thread Tools above your first post, select "Mark your thread as Solved".

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. How to create a sumif function with two criteria
    By Martin9 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 12-04-2012, 08:56 AM
  2. SUMIF criteria using the AND function
    By BobTheRocker in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-28-2011, 11:34 AM
  3. SUMIF function with multiple criteria
    By anna57 in forum Excel General
    Replies: 2
    Last Post: 12-02-2009, 08:45 AM
  4. Two Criteria in SumIf Function
    By Jack Gillis in forum Excel General
    Replies: 3
    Last Post: 11-15-2005, 01:00 PM
  5. Help with SUMIF function criteria
    By Marina in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 04-26-2005, 09:06 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1