+ Reply to Thread
Results 1 to 10 of 10

summing values using specific conditions

  1. #1
    Registered User
    Join Date
    02-01-2009
    Location
    Ohio, USA
    MS-Off Ver
    Excel 2003
    Posts
    4

    summing values using specific conditions

    Hello I am new to this forum so please bear with me...

    I am looking for help in developing steps in a spreadsheet to calculate a sum based on a few conditions. The basis of my spreadsheet works fine, however I am trying to add the contents of a cell to another by checking other cells.

    For example:

    Cells A1:A10 contain a numerical sequence (1-10 respectively) to indicate a "Node"

    Cells B1:B10 contain a user selected number (1-10) which defines the Node it is fed from. We'll call this "Fed From Node".......ie. If Cell B2=1, that means that Node 2 is fed from Node 1.

    Cells C1:C10 contain a value which is input by the user. We'll call this "Amps"

    Cells D1:D10 would show the total "Amps" of the current cell added to all others that are fed from same.

    What I am ultimately trying to figure out is how to add the "Amps" to each "Node" and show the results in column D.

    More specifically if the spreadshet looks like the following:

    Node-----Fed From Node-----Amps-------Total
    1--------------0----------------------0--------------22.5
    2--------------1---------------------10--------------22.5
    3--------------0----------------------0---------------0
    4--------------2---------------------7.5-------------12.5
    5--------------4----------------------5---------------5

    How would I add the "Amps" from Node5 to Node4 and Node4 to Node2 to achieve a total of 22.5 IF Node5 is fed from Node4 and Node4 is fed from Node2?

    I have tried macros and different excel formulas for the past few days and I am really stumped.

    Any help would be greatly appreciated.
    Last edited by elecengr; 02-02-2009 at 11:31 PM.

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

    Re: summing values using specific conditions

    Welcome to the Board.

    Could you perhaps explain why Node 1 has a total of 22.5 given fed from Node 0, yet Node 3 which is also fed from Node 0 has a total of 0.

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

    Re: summing values using specific conditions

    Having just now re-read your post, if we assume your headers are in A1:D1 and your sample values in A2:C6 then I can replicate your results (Total values) in D2:D6 using:

    D2: =$C2+LOOKUP(9.99999999999999E+307,CHOOSE({1,2},0,INDEX($D3:$D$7,MATCH($A2,$B3:$B$7,0),1)))
    copied down to D6

    The above assumes a 1:1 relationship in terms of "From Node"... ie no Node is used to "supply" more than one other Node... (this can be changed if necessary).

    However, I'm still not convinced the values you put for Total correspond the results you actually want to obtain... so please post up with more info if the above is not what you're after.
    Last edited by DonkeyOte; 02-01-2009 at 07:12 AM.

  4. #4
    Registered User
    Join Date
    02-01-2009
    Location
    Ohio, USA
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: summing values using specific conditions

    DonkeyOte,

    I think we are in the right direction, but not quite there yet......but that is my fault for not painting the entire picture.

    Your comment regarding "supplying more than one node" may be the answer, not sure but that is why I am asking for help.

    I have attached an example workbook with a few comments I have made after inserting your suggestion.

    If you could please take a look and provide suggestions I would greatly appreciate it.

    Thanks
    Attached Files Attached Files

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

    Re: summing values using specific conditions

    Given 1:many the key is to then change from an INDEX/MATCH (singular return) to a SUMIF (multiple) ... eg:

    D3:
    =$C3+LOOKUP(9.99999999999999E+307,CHOOSE({1,2},0,SUMIF($B4:$B$22,$A3,$D4:$D$22)))
    copied down

  6. #6
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: summing values using specific conditions

    In d2 and copy down to D21,

    =$C2 + SUMIF($B3:$B$21, $A2, D3:D$21)
    Entia non sunt multiplicanda sine necessitate

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

    Re: summing values using specific conditions

    shg, thanks for pointing that out ... er... it's Sunday (that's my excuse!)

  8. #8
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: summing values using specific conditions

    I think it's a little unusual formula as Excel goes, in that it requires a downward reference to build the result; sort of recursive.

    Notes to elecengr:

    1. From the top of the list, nodes must appear in column A before appearing in column B.

    2. Leave a blank row below the data.
    Last edited by shg; 02-01-2009 at 03:44 PM.

  9. #9
    Registered User
    Join Date
    02-01-2009
    Location
    Ohio, USA
    MS-Off Ver
    Excel 2003
    Posts
    4

    Thumbs up Re: summing values using specific conditions

    DonkeyOte & SHG,

    Thanks for all of your help.
    Those suggestions work perfectly now. You are lifesavers and timesavers.

    I have spent so much time trying to figure this out.

    Thank you so very much for your time and help.

  10. #10
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: summing values using specific conditions

    You’re welcome. Would you please mark the thread as Solved?

    Click the Edit button on your first post in the thread

    Click Go Advanced, select [SOLVED] from the Prefix dropdown, then click Save Changes

+ 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