Consulting

Results 1 to 6 of 6

Thread: Problems with Sum Function

  1. #1

    Problems with Sum Function

    Hi,


    is there any way to write such a formula? :


     
    For j = 1 To 3000
    For i = 1 To 8
    
    Sheets("Table1").Cells(j, 10).Formula = SUM_over j (Cells(j, 2) + SUM_over i(Cells(j, i) * (Cells(4, i - 1).Value - 0.5)) 
    
    Next i 
    Next j

  2. #2
    VBAX Expert Leith Ross's Avatar
    Joined
    Oct 2012
    Location
    San Francisco, California
    Posts
    552
    Location
    Hello Cinema,

    What is the code for the SUM_over ?
    Sincerely,
    Leith Ross

    "1N73LL1G3NC3 15 7H3 4B1L17Y 70 4D4P7 70 CH4NG3 - 573PH3N H4WK1NG"

  3. #3
    thats the problem I have. How can you define such a sum?

  4. #4
    Moderator VBAX Sage SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    7,814
    Location
    @ Cinema,

    You are the only person in the world who knows what SUM_over needs to do.
    I expect the student to do their homework and find all the errrors I leeve in.


    Please take the time to read the Forum FAQ

  5. #5
    VBAX Expert
    Joined
    May 2016
    Posts
    604
    Location
    Do you mean something like this:
    in J8
    =SUM(B$5:B8)+A$4*B8+B$4*C8+C$4*D8+D$4*E8+E$4*F8+F$4*G8+G$4*H8+H$4*I8-0.5
    Note: I assumed i starts at 2 not 1 Because:
    your equation will fall over as it is written when i=1 ( the start of the loop) Cells(4,i-1) will give a column index of zero,

  6. #6
    Mac Moderator VBAX Guru mikerickson's Avatar
    Joined
    May 2007
    Location
    Davis CA
    Posts
    2,778
    Perhaps something like

    =SUMPRODUCT(B2:I3001,A1:H3000-.5)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •