+ Reply to Thread
Results 1 to 10 of 10

Productif Function?

  1. #1
    Registered User
    Join Date
    07-11-2014
    Location
    San Francisco, CA
    MS-Off Ver
    MS Office 2010
    Posts
    2

    Productif Function?

    I am trying to do a formula that does a multiplication instead of adding it, but there is no such function.

    A B C
    1 Value Quantity Department
    2 $25 5 100
    3 $10 6 200
    4 $50 1 100


    I need a formula that would, return $175 (5 x $25 + 1 x $50) if I want to get the values for department 100, and $60 (6 x $10) if I get the value for deparment 200.

    I have more departments (100, 200, 300, 400, 500, 600, and 700), but the above is just an example.

  2. #2
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Productif Function?

    Try

    =SUMPRODUCT(--(C2:C4=100),A2:A4*B2:B4)

  3. #3
    Registered User
    Join Date
    07-11-2014
    Location
    San Francisco, CA
    MS-Off Ver
    MS Office 2010
    Posts
    2

    Re: Productif Function?

    That's awesome. It worked. I never used the -- before, and I dont know what it is, but I'll figure it out later.

  4. #4
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Productif Function?

    You're welcome.

    The -- is called a double unary

    It basically multiplies a value by -1, then multiplies by -1 again.

    This is used to convert the True/False results of the expression C2:C4=100 to a 1 or a 0 (True=1, False=0)

  5. #5
    Forum Expert Vikas_Gautam's Avatar
    Join Date
    06-04-2013
    Location
    Ludhiana,Punjab, India
    MS-Off Ver
    Excel 2013
    Posts
    1,850

    Re: Productif Function?

    =sum(if(C:C=100,(A:A)*(B:B)))

    use ctrl shift enter to enter the formula...

    Say thanks, click *

  6. #6
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Productif Function?

    Quote Originally Posted by Jonmo1 View Post
    Try

    =SUMPRODUCT(--(C2:C4=100),A2:A4*B2:B4)
    This syntax is slightly faster to calculate:

    =SUMPRODUCT(--(C2:C4=100),A2:A4,B2:B4)
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  7. #7
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Productif Function?

    Quote Originally Posted by joseli View Post
    I never used the -- before, and I dont know what it is, but I'll figure it out later.
    See this:

    http://xldynamic.com/source/xld.SUMPRODUCT.html

  8. #8
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Productif Function?

    Quote Originally Posted by Tony Valko View Post
    =SUMPRODUCT(--(C2:C4=100),A2:A4,B2:B4)
    Where would this be on the speed scale?
    =SUMPRODUCT((C2:C4=100)*A2:A4*B2:B4)

  9. #9
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Productif Function?

    Data Range
    D
    E
    F
    G
    H
    I
    J
    2
    n*n
    0.00078
    0.00074
    0.00074
    0.00074
    0.00075
    0.00075
    3
    n,n
    0.00071
    0.00071
    0.00071
    0.00069
    0.00068
    0.00069

    Tested in Excel 2002

    The bigger the range the greater the difference.

  10. #10
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Productif Function?

    Makes sense, let sumproduct do the math itself whenever possible.

+ 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. ProductIf
    By pdsvsv in forum Excel - New Users/Basics
    Replies: 6
    Last Post: 05-22-2010, 07:58 PM
  2. Productif
    By naturallight in forum Excel General
    Replies: 6
    Last Post: 11-17-2009, 01:48 PM
  3. PRODUCTIF function
    By igesta in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-17-2006, 07:26 AM
  4. I need a productif style function
    By Mitch in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 05-04-2006, 12:55 PM
  5. [SOLVED] I need a productif type function
    By Mitch in forum Excel General
    Replies: 5
    Last Post: 05-04-2006, 12:40 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