+ Reply to Thread
Results 1 to 9 of 9

sumproduct with if statement?

  1. #1
    Registered User
    Join Date
    07-20-2009
    Location
    Orlando, Florida
    MS-Off Ver
    Excel 2007
    Posts
    8

    sumproduct with if statement?

    Volume Unit Cost Before
    44 14.11 n/a
    9 10.46 8.58
    37 9.61 7.88
    20 8.26 6.77
    78 7.36 6.04
    0 3.65 n/a


    Can someone show me how to multiple column a*b if column c is "n/a". And column a*c if it has a number, with suming them at the end?

    Thanks

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: sumproduct with if statement?

    Try:

    =SUMPRODUCT(--ISNUMBER(C2:C7),A2:A7,C2:C7)+SUMPRODUCT(--(C2:C7="n/a"),A2:A7,B2:B7)
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: sumproduct with if statement?

    Or, if preferred

    =SUM(A2:A7*IF(ISNUMBER(C2:C7),C2:C7,B2:B7))
    confirmed with CTRL + SHIFT + ENTER

  4. #4
    Registered User
    Join Date
    07-20-2009
    Location
    Orlando, Florida
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: sumproduct with if statement?

    Not working for me. What does the "--" do?

  5. #5
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: sumproduct with if statement?

    They coerce arrays of TRUE/FALSE to 1/0, respectively so Sumproduct can do the math...

    How is it not working?

    Are you sure you have the ranges correct?

    Are the numbers in column C actually formatted as numbers?

    Try selecting column C and go to Data|Text to Columns and click Finish.

  6. #6
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: sumproduct with if statement?

    Here it is working with your data.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    07-20-2009
    Location
    Orlando, Florida
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: sumproduct with if statement?

    I am confirming with "shift+ctrl+enter" and it still pulls an error. I have really never play with arrays before so I am kinda thinking I am messing it up.

  8. #8
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: sumproduct with if statement?

    See my last 2 posts or attach a spreadsheet showing issue.

  9. #9
    Registered User
    Join Date
    07-20-2009
    Location
    Orlando, Florida
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: sumproduct with if statement?

    Got it. Thanks for the help!

+ 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