+ Reply to Thread
Results 1 to 9 of 9

Diagonal sum, with column definition as a variable

  1. #1
    Registered User
    Join Date
    06-05-2014
    Posts
    5

    Diagonal sum, with column definition as a variable

    Hey,

    I am trying to solve the following problem:

    I am using the formula below, to calculate the diagonal sum:

    {=SUM(N(INDIRECT(ADDRESS(ROW(32:34);ROW(2:4)))))}

    However, I want to replace the second cell reference of the ROW definition, i.e. here 34 and 4 with a variable, or value of a cell.

    How can I do this?

    Thanks a lot in advance!

  2. #2
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Diagonal sum, with column definition as a variable

    Hi,

    That's not a very rigorous construction in any case. Can you please post a workbook with an example and your expected result?

    Regards
    Click * below if this answer helped

    Advanced Excel Techniques: http://excelxor.com/

  3. #3
    Registered User
    Join Date
    06-05-2014
    Posts
    5

    Re: Diagonal sum, with column definition as a variable

    Example.PNG

    I hope that the screenshot examplifies the problem well enough.

  4. #4
    Registered User
    Join Date
    06-05-2014
    Posts
    5

    Re: Diagonal sum, with column definition as a variable

    I want to avoid, having to change the sum formula each time, I change the number of cells to be added up.

  5. #5
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Diagonal sum, with column definition as a variable

    Sorry - I meant an actual Excel workbook.

    Regards

  6. #6
    Registered User
    Join Date
    06-05-2014
    Posts
    5

    Re: Diagonal sum, with column definition as a variable

    You mean uploading an excel file? I am unable to find this sort of button. I am sorry, but I am new to this forum...

  7. #7
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Diagonal sum, with column definition as a variable

    No worries. Click on Go Advanced and scroll down to Manage Attachments.

    Regards

  8. #8
    Registered User
    Join Date
    06-05-2014
    Posts
    5

    Re: Diagonal sum, with column definition as a variable

    EXCEL FORUM.xlsx

    The diagonal sum, which I am struggeling with is in row 91. I want to make the number of cells to be added up dependent on L1.

  9. #9
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Diagonal sum, with column definition as a variable

    Thanks.

    It's quite a nice approach that you have there, and certainly quite succinct, though also volatile, inflexible, unrigorous and requiring array-entry.

    I personally would prefer a slightly longer formula, though which has none of those drawbacks. In B91:

    =SUMPRODUCT((ROW(B47:AP87)-MIN(ROW(B47:AP87))+1=COLUMN(B47:AP87)-MIN(COLUMN(B47:AP87))+1)*(COLUMN(B47:AP87)-MIN(COLUMN(B47:AP87))+1<=$L$1)*B47:AP87)

    though this is a single-cell solution, and I'm not quite sure what your intended results are, i.e. whether you want this formula to be dragged across to the right and, if so, how this should be reflected in the results.

    Regards

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Variable Last Row Definition
    By NCF in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-29-2013, 04:20 PM
  2. [SOLVED] Variable definition problem
    By Orestees in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 09-17-2012, 02:46 PM
  3. How to insert a variable or formula in a cell definition
    By Daniel Sher in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-04-2008, 03:39 PM
  4. OleoObject name variable definition
    By mmf in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 05-05-2008, 05:09 PM
  5. Excel question with variable definition
    By Yong Kim in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-04-2005, 02:06 PM

Tags for this Thread

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