+ Reply to Thread
Results 1 to 12 of 12

Using sumproduct with conditions

  1. #1
    Registered User
    Join Date
    04-25-2013
    Location
    Norway
    MS-Off Ver
    Excel 2013
    Posts
    10

    Using sumproduct with conditions

    Hi everyone,
    Sorry for the bad english. I am working on a large spreadsheet and need to figure out porfolio returns. Basically I need to sumproduct the weight of each stock with the appropriate return but only if the rank/position matches that of the portofolio (eg. 1,2 or 3). So in the example below (see attachment) for D19 I would need to sumproduct all A.Returns with postition 1 with the weight. Can this be done with the sumproduct?

    Attachment 234431

  2. #2
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Using sumproduct with conditions

    Your attachment doesn't work.
    <---------If you like someone's answer, click the star to the left of one of their posts to give them a reputation point for that answer.
    Ron W

  3. #3
    Registered User
    Join Date
    04-25-2013
    Location
    Norway
    MS-Off Ver
    Excel 2013
    Posts
    10

    Re: Using sumproduct with conditions

    Sorry, I'm new to this.... I cant seem to upload the file.

  4. #4
    Registered User
    Join Date
    04-25-2013
    Location
    Norway
    MS-Off Ver
    Excel 2013
    Posts
    10

    Re: Using sumproduct with conditions

    Think it should be attached now
    Attached Files Attached Files
    Last edited by maxfiesta; 05-09-2013 at 11:01 AM.

  5. #5
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Using sumproduct with conditions

    Maybe with an pivot table.
    Attached Files Attached Files
    Notice my main language is not English.

    I appreciate it, if you reply on my solution.

    If you are satisfied with the solution, please mark the question solved.

    You can add reputation by clicking on the star * add reputation.

  6. #6
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,938

    Re: Using sumproduct with conditions

    try this, copied down and across...
    =SUMPRODUCT(($B$3:$B$14=LEFT(D$18,1))*($C$3:$C$14=$C19)*($D$3:$D$14)*($F$3:$F$14))
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  7. #7
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Using sumproduct with conditions

    Maybe this is what you are looking for:
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    04-25-2013
    Location
    Norway
    MS-Off Ver
    Excel 2013
    Posts
    10

    Re: Using sumproduct with conditions

    newdoverman: This only returns the sum of all the labelled 1 returns unfortunately. I need those to be multiplied with the weights.
    Attached Files Attached Files
    Last edited by maxfiesta; 05-09-2013 at 12:08 PM.

  9. #9
    Registered User
    Join Date
    04-25-2013
    Location
    Norway
    MS-Off Ver
    Excel 2013
    Posts
    10

    Re: Using sumproduct with conditions

    FDibbins: Sorry, calculates wrong value.
    Last edited by maxfiesta; 05-09-2013 at 12:26 PM.

  10. #10
    Registered User
    Join Date
    04-25-2013
    Location
    Norway
    MS-Off Ver
    Excel 2013
    Posts
    10

    Re: Using sumproduct with conditions

    By using newdovermans suggestion of
    =SUMPRODUCT(--($C$3:$C$14=$C23);--(D$3:D$14))
    and multiplying this value by the weight, it gives me the correct answer.
    I do not know how to incorporate this into the formula however.
    Thanks for the help to you both.

  11. #11
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,938

    Re: Using sumproduct with conditions

    it doesnt, i tested it. try again
    Attached Files Attached Files
    Last edited by FDibbins; 05-09-2013 at 12:58 PM.

  12. #12
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Using sumproduct with conditions

    Ok, this incorporates the weights.
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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