+ Reply to Thread
Results 1 to 5 of 5

Dynamic SUM function needed

Hybrid View

  1. #1
    Registered User
    Join Date
    03-14-2013
    Location
    Tingsryd, Sweden
    MS-Off Ver
    Excel 2010
    Posts
    2

    Dynamic SUM function needed

    Hello

    I'm currently trying to make a Excel sheet calculating the Silver-Meal algorithm. As a part of that I need a SUM function that sums a dynamic range of cells depending on a binary input in a third cell, and this is where I get stuck.
    As in the example below, B colum sums the values in A column until there is a "1" (or any other binary value) in C column, then i starts over again.
    I have tried to solve this using combinations of IF and SUM formulas without any success. Does anyone have a solution for this problem? Thanks


    ...A B C
    1|0 0 0
    2|2 2 0
    3|3 5 1
    4|2 2 0
    5|4 6 0
    6|3 9 1

    PS. I anyone have experience in calculating Silver-Meal in Excel without VBA programming, please feel free to contact me. DS.
    Last edited by snurrepang; 03-14-2013 at 09:13 AM.

  2. #2
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,702

    Re: Dynamic SUM function needed

    Hello snurrepang, welcome to Excel Forum

    In B1 use this formula

    =A1

    then in B2 copied down this version

    =A2+(C1=0)*B1
    Audere est facere

  3. #3
    Registered User
    Join Date
    03-14-2013
    Location
    Tingsryd, Sweden
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: Dynamic SUM function needed

    That was truly an elegant solution and it works like a charm! Thank you very much.

  4. #4
    Registered User
    Join Date
    05-19-2013
    Location
    Sweden
    MS-Off Ver
    Excel 2013
    Posts
    1

    Re: Dynamic SUM function needed

    Quote Originally Posted by daddylonglegs View Post
    Hello snurrepang, welcome to Excel Forum

    In B1 use this formula

    =A1

    then in B2 copied down this version

    =A2+(C1=0)*B1
    I'm trying to create a similar calculation using another heuristic. How does the "(C1=0)*B1" part work? What is it called? Where can i read more about it?

    Thanks in advance!

  5. #5
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,610

    Re: Dynamic SUM function needed

    The C1=0 part on its own returns TRUE or FALSE.
    As in this case it is involved in an arithmetic operation , TRUE or FALSE are coerced to 1 or 0. So if C1 =1 ,(C1=0)*B1 returns 0 because C1=0 is FALSE

+ 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