+ Reply to Thread
Results 1 to 6 of 6

Sum Array calculation error

  1. #1
    Registered User
    Join Date
    05-07-2010
    Location
    New Hampshire, USA
    MS-Off Ver
    Excel 2003
    Posts
    2

    Sum Array calculation error

    I'm teaching myself arrays, and I've come across a strange phenomena when using a =sum(row array.

    Assume that the numbers 1-10 are entered into cells A1:A10. If I write an array =sum(row(A1:A10)) then the formula returns 55. However, if I enter that same data into cells A2:A11 and adjust the array accordingly, the answer returned is 65. It seems that every row that I move the numbers down adds 10 to the value.

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

    Re: Sum Array calculation error

    That formula isn't summing the cell contents, it's summing the numbers generated by the row function so for

    =sum(row(A1:A10))

    you are summing

    {1;2;3;4;5;6;7;8;9;10} = 55

    but for

    =sum(row(A2:A11))

    you are summing

    {2;3;4;5;6;7;8;9;10;11}=65

    the contents of those cells is irrelevant

  3. #3
    Forum Contributor day92's Avatar
    Join Date
    04-20-2010
    Location
    Los Angeles
    MS-Off Ver
    Excel 360
    Posts
    600

    Re: Sum Array calculation error

    Im not seeing that when I do it. Do you have an example?

  4. #4
    Forum Contributor
    Join Date
    12-03-2009
    Location
    Providence RI
    MS-Off Ver
    Excel 2007, Excel 2010
    Posts
    260

    Re: Sum Array calculation error

    Press F1 when using the ROW function to see how ROW works. He is correct, ROW will simply give the value of the row. Try changing the values in the cells in A1:A10 and you will see your formula will not provide any different results.

  5. #5
    Forum Expert contaminated's Avatar
    Join Date
    05-07-2009
    Location
    Baku, Azerbaijan
    MS-Off Ver
    Excel 2013
    Posts
    1,430

    Re: Sum Array calculation error

    In {=SUM(ROW(A1:A10))} ROW function returns row number for each selected cell ie this array
    ={SUM({1,2,3,4,5,6,7,8,9,10})}
    SUM of these formula would be 55.

    When you enter same data dor A2:A11 ROW function creates belowstated array within SUM.
    ={SUM({2,3,4,5,6,7,8,9,10,11})}
    SUM of these formula would be 55.

    For the future, try to Evaluate formula. It helps to understand it more easily (Tools>Formula Auditing> Evaluate Formula.)

    HTH
    Люди, питающие благие намерения, как раз и становятся чудовищами.

    Regards, ?Born in USSR?
    Vusal M Dadashev

    Baku, Azerbaijan

  6. #6
    Registered User
    Join Date
    05-07-2010
    Location
    New Hampshire, USA
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: Sum Array calculation error

    Very interesting. Thank you, that helps.

    EDIT: I have another question though. This one is more complicated.

    I am creating a formula that will find the average of a set of values in a column, where the specific values that I need are entered every 7 cells. I can use the OFFSET function to do this once with AVERAGE(OFFSET(A1,7,0,1,1)), but I need to have it go on continually in an automated fashion. Any suggestions?
    Last edited by AaronMS; 05-07-2010 at 11:52 AM.

+ 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