+ Reply to Thread
Results 1 to 22 of 22

Sumif two colomns to ignore if a value is present

  1. #1
    Valued Forum Contributor
    Join Date
    08-10-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    721

    Sumif two colomns to ignore if a value is present

    I have two colomns with $ amounts in it, a forecast and an actual.
    I want to sumif the forecast colomn but if there is an amount in the actual I want the sum of that number rather than the forecast one.

    Example

    Forecast Actual


    $183,000 $187,000
    $170,000 $194,760
    $225,000
    $1,891 $2,000
    $64,000
    $20,500 $20,287

    Current Sumif formula =SUMIFS($AH$17:$AH$190,$J$17:$J$190,"Red",$B$17:$B$190,"Company")
    Produces just the sum of the Forecast colomn. I want the actual Sum to Sum the Actual (if there is one) + the sum of the Forecast if there is none in the Actual.
    So the formula should produce the result of the items in bold above.

    Any ideas?

  2. #2
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Sumif two colomns to ignore if a value is present

    With your Forecast in A2 Down, and Actual in B2 Down
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    If you need any more information, please feel free to ask.

    However,If this takes care of your needs, please select Thread Tools from menu above and set this topic to SOLVED. It helps everybody! ....

    Also
    اس کی مدد کرتا ہے اگر
    شکریہ کہنے کے لئے سٹار کلک کریں
    If you are satisfied by any members response to your problem please consider using the small Star icon bottom left of their post to show your appreciation.

  3. #3
    Valued Forum Contributor
    Join Date
    08-10-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    721

    Re: Sumif two colomns to ignore if a value is present

    Marcol,

    Thanks for the logic, but I need it to work as a Sumif as I need a further conditions just like in my formula above as I need to return the result of your formula when $J$17:$J$190,"Red",$B$17:$B$190,"Company"

    ie why doesnt this work

    =SUMIFS(((H18:H190,"",G18:G190)+SUM(H18:H190)),$J$17:$J$190,"Red",$B$17:$B$190,"Company")
    Last edited by nickmax1; 01-18-2013 at 10:33 AM.

  4. #4
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Sumif two colomns to ignore if a value is present

    Would the result you are looking for in your sample be $664,391.00?

  5. #5
    Valued Forum Contributor
    Join Date
    08-10-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    721

    Re: Sumif two colomns to ignore if a value is present

    no - 693,047

    John you are summing up the NON bold items. I want the Actual colomn summed up unless there is none in which case the Forecast number should be used.
    Last edited by nickmax1; 01-18-2013 at 10:42 AM.

  6. #6
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Sumif two colomns to ignore if a value is present

    Ok, had my columns mixed up. I was going to suggest using sumproduct. This returns that result as well.

    =SUMPRODUCT((B2:B7 = "")*(A2:A7))+SUM(B2:B7)

  7. #7
    Valued Forum Contributor
    Join Date
    08-10-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    721

    Re: Sumif two colomns to ignore if a value is present

    thanks, but that doenst solve my issue with my other criteria.
    I want the sum of those colomns if two other conditions are met (see post 1)

  8. #8
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Sumif two colomns to ignore if a value is present

    Try this array formula

    =SUM(IF((J18:J190="Red")*(B18:B190="Company"),IF(H18:H190="",G18:G190,H18:H190)))

    confirmed with CTRL+SHIFT+ENTER

    that checks your two conditions then gets the value from Actual column H (if there is one), otherwise from Forecast column G
    Audere est facere

  9. #9
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Sumif two colomns to ignore if a value is present

    Which Range in your formula in Post 1 represents Actual and which represents Formula?

  10. #10
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Sumif two colomns to ignore if a value is present

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


    Use the same logic using COUNTIFS() instead of SUMPRODUCT() for 2007 and above.
    Attached Files Attached Files

  11. #11
    Valued Forum Contributor
    Join Date
    08-10-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    721

    Re: Sumif two colomns to ignore if a value is present

    to try and make this clear (sorry for going a roundabout way) here is a more detailed example

    Source Forecast Actual Likelihood

    Company $183,000* $187,000* Red
    Company $170,000* $194,760* Red
    Other $225,000* Green
    Other $1,891 *$2,000* Green
    Company $64,000* Red
    Other $20,500 *$20,287* Red
    Company $5,000 $7,000 Red

    so again the formula is to use Actual where possible, and only for the lines where it is "Red" under likelihood and "Company" in the first colomn. Hopefully my original formula in post 1 makes more sense now.

  12. #12
    Valued Forum Contributor
    Join Date
    08-10-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    721

    Re: Sumif two colomns to ignore if a value is present

    Daddylonglegs i get a value error on your formula

    Marcol that seems to work!! testing now.....

  13. #13
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Sumif two colomns to ignore if a value is present

    Here's a workbook with your data from post#11

    I've included DLLs' array formula for comparism. (Confirm with Ctrl+Shift+Enter)
    Attached Files Attached Files

  14. #14
    Valued Forum Contributor
    Join Date
    08-10-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    721

    Re: Sumif two colomns to ignore if a value is present

    Marcol that is wonderful. thank you for your work. Before i assign this thread as solved could I ask one more favour and that is if you add another colomn to your sheet called Status (Colomn E for example) and if any cells in E are either "NTU" or "Dead" they are to be ignored/omitted from the sum?

  15. #15
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Sumif two colomns to ignore if a value is present

    Assuming that "Status" is either "NTU", "Dead", or blank.
    See this workbook, again I have adapted and included DLLs' array formula.

    Select from the validation drop-downs in "Status"
    Attached Files Attached Files

  16. #16
    Valued Forum Contributor
    Join Date
    08-10-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    721

    Re: Sumif two colomns to ignore if a value is present

    Possible statuses are as follows
    Quoted ****
    Bound ****
    NTU
    WIP ****
    Modelling ****
    Declined
    Non-Renewed
    Extended

    only the ones withe asterixs on them are to be included in the sum ?

  17. #17
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Sumif two colomns to ignore if a value is present

    With that many conditions I would be tempted to use a Lookup Table and a Helper Column.

    If you use the helper in Column F, use the formula in H2 or J2
    If you use the helper in Column L, use the formula in M2 or N2

    With the Lookup Table, enter "Yes" against each catagory to be included with your other conditions.
    Attached Files Attached Files

  18. #18
    Valued Forum Contributor
    Join Date
    08-10-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    721

    Re: Sumif two colomns to ignore if a value is present

    thanks again for your help Marcol, but i would really like to be able to do this in the formula? Is it possible?

  19. #19
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Sumif two colomns to ignore if a value is present

    Quote Originally Posted by nickmax1 View Post
    Daddylonglegs i get a value error on your formula
    You have to enter formula with key combination CTRL+SHIFT+ENTER

    This version works with no helper columns

    =SUM(IF((D2:D10="Red")*(A2:A10="Company")*ISNUMBER(MATCH(E2:E10,{"Quoted","Bound","WIP","Modelling"},0)),IF(C2:C10="",B2:B10,C2:C10)))

    paste that formula in a cell, press F2 key to select formula then hold down CTRL and SHIFT keys while pressing ENTER. If done correctly curly braces like { and } will appear around the formula in the formula bar

  20. #20
    Valued Forum Contributor
    Join Date
    08-10-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    721

    Re: Sumif two colomns to ignore if a value is present

    absolutely brilliant thank you all

  21. #21
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Sumif two colomns to ignore if a value is present

    And to complete the set, not so elegant, but not CSE entered
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  22. #22
    Valued Forum Contributor
    Join Date
    08-10-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    721

    Re: Sumif two colomns to ignore if a value is present

    thanks Marcol!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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