Closed Thread
Results 1 to 10 of 10

IF formula inside SUMIFS?

  1. #1
    Registered User
    Join Date
    01-07-2013
    Location
    Norway
    MS-Off Ver
    Excel 2013
    Posts
    5

    IF formula inside SUMIFS?

    I'm wondering if it's possible to use an IF statement inside a SUMIFS formula.

    I have a table with sales transactions with corresponding department number where the sales is happend. There will be some transactions with no department. What i want is to select a department and get the sum, that works fine. But if none department is selected (" ") i want to get the total sales. Ie in attached file, that means getting the sum 206 in reventue.

    Is this possible?
    Attached Files Attached Files

  2. #2
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.84 (24041420))
    Posts
    8,751

    Re: IF formula inside SUMIFS?

    try
    =IF(C11="", SUM(B2:B8),SUMIFS(B2:B8,C2:C8,C11))

    your range on the SUMIF is B2:B8 - which includes the title - so B3:B8 is the number
    =IF(C11="", SUM(B3:B8),SUMIFS(B3:B8,C3:C8,C11))
    Last edited by etaf; 09-19-2016 at 04:04 AM.
    Wayne
    if my assistance has helped, and only if you wish to , there is an "* Add Reputation" on the left hand side - you can add to my reputation here

    If you have a solution to your thread - Please mark your thread solved do the following: >
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  3. #3
    Forum Contributor
    Join Date
    02-26-2014
    Location
    Aylsham, Norfolk, UK
    MS-Off Ver
    Excel 365
    Posts
    126

    Re: IF formula inside SUMIFS?

    Enter the following formula, that should fix it

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Basically it looks at the cell, if it's empty it sums all, otherwise per department.

  4. #4
    Registered User
    Join Date
    01-07-2013
    Location
    Norway
    MS-Off Ver
    Excel 2013
    Posts
    5

    Re: IF formula inside SUMIFS?

    Thanx etaf and llamafarmer

    In my example it's only one criteria, in my actual file I have many;

    =SUMIFS(sum_range;criteria_range1;criteria;criteria_range2:criteria;criteria_range3;??)

    criteria 1 and 2 always have numbers and there is no need for an IF. Criteria 3 is department number. Criteria 1 is companynr and should equal C11. Criteria 2 is account and should be C15 for C16, D15 for D16 etc. But how do you include criteria 3?

    See the new attached file, how would you solve this?
    Attached Files Attached Files
    Last edited by ovehendrix; 09-19-2016 at 06:04 AM.

  5. #5
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.84 (24041420))
    Posts
    8,751

    Re: IF formula inside SUMIFS?

    you can use a sumproduct()
    =SUMPRODUCT((C3:C8=C12)*(D3:D8=C11)*(E3:E8=C15)*B3:B8)

    to copy across the row 16 use
    in C16
    =SUMPRODUCT(($C$3:$C$8=$C$12)*($D$3:$D$8=$C$11)*($E$3:$E$8=C15)*$B$3:$B$8)
    and copy across to
    D16 and E16

    and copy

  6. #6
    Registered User
    Join Date
    01-07-2013
    Location
    Norway
    MS-Off Ver
    Excel 2013
    Posts
    5

    Re: IF formula inside SUMIFS?

    Excellent etaf, works perfect. Now time to do some reading on sumproduct.

  7. #7
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.84 (24041420))
    Posts
    8,751

    Re: IF formula inside SUMIFS?

    you are welcome and thanks for the rep

  8. #8
    Registered User
    Join Date
    10-18-2023
    Location
    Nottingham
    MS-Off Ver
    Google Sheets
    Posts
    5

    Re: IF formula inside SUMIFS?

    Hi,
    I know this post is old, however I wanted to see if you had a solution to a problem that is similar?
    Similar to how ovehendrix had a single filter, I wanted to have three, Company, Month and Channel.
    All I'd need it to SUM the Reach column dependent on the filters engaged. If a filter is blank, it would count all.
    I can't post links (due to being a newbie) but happy to supply files or Sheet links if anyone can help.

    Thanks

  9. #9
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.84 (24041420))
    Posts
    8,751

    Re: IF formula inside SUMIFS?

    i would post a new thread , that way more people will view the question, as this is solved

    just looked at your profile and see that you have started a new thread

  10. #10
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,916

    Re: IF formula inside SUMIFS?

    @Rutter

    You already have your own thread on this - do NOT hijack other members' thrads, please (see the Forum Rules). Thanks.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

Closed Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] How to restrict pop of message box inside multiple times when it is inside a for loop?
    By timmu in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-26-2014, 06:00 AM
  2. Help nesting an OR function inside a SUMIFS function
    By wes228 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 06-21-2014, 06:22 PM
  3. [SOLVED] Sumifs, problem with the formula: =sumifs(c10:c200,<=today(),0)
    By Faustocruz in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 10-08-2012, 04:26 AM
  4. Replies: 1
    Last Post: 10-02-2012, 04:27 PM
  5. [SOLVED] external link reference formula inside formula user input
    By jscc in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-20-2012, 04:29 PM
  6. Excel 2007 : SUM inside SUMIFS?
    By thart21 in forum Excel General
    Replies: 4
    Last Post: 09-30-2011, 01:58 PM
  7. Excel 2007 : sumifs inside of a vlookup ?
    By budchevy in forum Excel General
    Replies: 4
    Last Post: 05-15-2011, 06:33 PM

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