+ Reply to Thread
Results 1 to 7 of 7

Sumproduct based on adjacent cell ID Code

  1. #1
    Forum Contributor
    Join Date
    12-15-2005
    MS-Off Ver
    Office 2007
    Posts
    346

    Sumproduct based on adjacent cell ID Code

    Attached is an example.

    Basically I am trying to get the sumproduct of a column of amounts based on the adjacent cells ID code.

    For example column B will have codes 1FHD, 2FHS, 3FHG etc. these codes will be mixed otherwise I would have just did a sum of the cells.

    Column C would have dollar amounts.

    Sumproduct based on adjacent cell ID Code
    Attached Files Attached Files
    Last edited by avidcat; 05-03-2009 at 02:39 PM.

  2. #2
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Sumproduct based on adjacent cell ID Code

    just use sumif
    =SUMIF($B$7:$B$23,B2,$C$7:$C$23) (note remove the colon on b2)
    will give total for c7:c23 =1FHD

    OR if you really want to keep :
    =SUMIF($B$7:$B$23,SUBSTITUTE(B2,":",""),$C$7:$C$23)
    Last edited by martindwilson; 05-02-2009 at 05:17 PM.
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  3. #3
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,632

    Re: Sumproduct based on adjacent cell ID Code

    Try this in C2:

    =SUMPRODUCT(1*(B7:B23=B2);C7:C23)

    Where b2 is 1FHD without :

  4. #4
    Forum Contributor
    Join Date
    12-15-2005
    MS-Off Ver
    Office 2007
    Posts
    346

    Re: Sumproduct based on adjacent cell ID Code

    I am not sure what you meant by remove the colon on B2, but this one worked:

    =SUMIF($B$7:$B$23,SUBSTITUTE(B2,":",""),$C$7:$C$23)

    Thanks.

  5. #5
    Forum Contributor
    Join Date
    12-15-2005
    MS-Off Ver
    Office 2007
    Posts
    346

    Re: Sumproduct based on adjacent cell ID Code

    Follow up,

    How can I get this to work for two different codes in two different cells? Basically I want to return the sum if either code is associtated with it.

    =SUMIF($B$13:$B$500,SUBSTITUTE(D5,":",""),$C$13:$C$500)

    so it would be D5 & D6 for the codes.

    Thanks.

  6. #6
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,632

    Re: Sumproduct based on adjacent cell ID Code

    =sumif($b$13:$b$500,substitute(d5,":",""),$c$13:$c$500)+sumif($b$13:$b$500,substitute(d6,":",""),$c$13:$c$500)

  7. #7
    Forum Contributor
    Join Date
    12-15-2005
    MS-Off Ver
    Office 2007
    Posts
    346

    Re: Sumproduct based on adjacent cell ID Code

    Thanks,

    I pretty much did that but I didn't add the sumif again.

    Thanks!

+ 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