+ Reply to Thread
Results 1 to 3 of 3

array formula question

  1. #1
    Registered User
    Join Date
    11-13-2007
    Posts
    1

    array formula question

    hello all,

    I'm struggling with some arrays/formulas that will make my life a lot easier if I get it right. Here is my situtation.

    I need to take 1 row of cells and then multiply it and add (sumproduct) to another row of cells. Easy right. Well the more difficult part is I need to do this over and over again to a column of cells with breaks in it.

    Heres a small part of my structure currently. These are the formulas I'm using for each cell down a column. This makes my life partially easier, by allowing me to copy/paste formulas.

    =SUMPRODUCT(M29:Z29,$M$12:$Z$12) - (This would be cell AA29)
    =SUMPRODUCT(M30:Z30,$M$12:$Z$12) - (This would be cell AA30)
    =SUMPRODUCT(M33:Z33,$M$12:$Z$12) - (This would be cell AA33)
    =SUMPRODUCT(M34:Z34,$M$12:$Z$12) - (This would be cell AA34)

    However, what I would really like to do is make an array out of all these cells, so that when I make a modification to them (like changing the M12:Z12 to 13) the entire array updates.
    The issue I have when creating the array is the function always uses the same cell input array (M29:Z29), it doesnt increment the input cell array (from 29 to 30 to 33 to 34, etc).

    Any suggestions?

    Thanks in advance.

  2. #2
    Valued Forum Contributor Excelenator's Avatar
    Join Date
    07-25-2006
    Location
    Wantagh, NY
    Posts
    333
    Assuming your first formula is on Row 29 you could use

    =SUMPRODUCT(M29:Z29,$M$12:$Z$12)-(INDIRECT("AA"&ROW()))

    and then simply copy the formula down.
    ---------------------------------------------------
    ONLY APPLIES TO VBA RESPONSES WHERE APPROPRIATE
    To insert code into the VBE (Visual Basic Editor)
    1. Copy the code.
    2. Open workbook to paste code into.
    3. Right click any worksheet tab, select View Code
    4. VBE (Visual Basic Editor) opens to that sheets object
    5. You may change to another sheets object or the This Workbook object by double clicking it in the Project window
    6. In the blank space below the word "General" paste the copied code.

  3. #3
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675
    From what you described I don't think you would need to change the formula. If you have this formula

    =SUMPRODUCT(M29:Z29,$M$12:$Z$12)

    in AA29 and copied down the column you can quite easily change the second range in AA29 only and then double click the "fill-handle" to replicate the change all the way down the column.

    ....or is it more complex than that?

+ 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