+ Reply to Thread
Results 1 to 4 of 4

SumIF applied to a dynamic range

  1. #1
    Forum Contributor timtim89's Avatar
    Join Date
    01-05-2012
    Location
    Copenhagen, Denmark
    MS-Off Ver
    Excel 2010
    Posts
    141

    SumIF applied to a dynamic range

    Hey all,

    I hope to apply a SumIF function to a range defined by a few variables (lastRow, lastCol ect.). I prefer the result left in the cells as just the number, but getting the result by applying a formula in the cell will work as well. I have tried a few things, but couldn't make it work, so I really hope someone can help me out. Please see attached file, as it shows better what I need done. Thanks a lot in advance for you effort!
    To make it easier I took most of the code out, leaving this:

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by timtim89; 02-23-2013 at 11:27 PM.

  2. #2
    Forum Contributor timtim89's Avatar
    Join Date
    01-05-2012
    Location
    Copenhagen, Denmark
    MS-Off Ver
    Excel 2010
    Posts
    141

    Re: SumIF applied to a dynamic range

    I considered the .FormulaR1C1 method as well, but it didn't seem that I could determine the span of the formula with ranges. Any suggestions, please?

  3. #3
    Forum Expert
    Join Date
    07-16-2010
    Location
    Northumberland, UK
    MS-Off Ver
    Excel 2007 (home), Excel 2010 (work)
    Posts
    3,054

    Re: SumIF applied to a dynamic range

    I think what you're trying to do is this:

    Please Login or Register  to view this content.
    If you're using WorksheetFunction.SumIF that's allowing you to run a SUMIF from within a macro, if you want to insert a formula you just write it into the text of the formula.

  4. #4
    Forum Contributor timtim89's Avatar
    Join Date
    01-05-2012
    Location
    Copenhagen, Denmark
    MS-Off Ver
    Excel 2010
    Posts
    141

    Re: SumIF applied to a dynamic range

    Thanks for the answer Andrew. The thing is that the formula depends on the parameters, which will change from time to time. Therefore, I need a formula where the ranges are given by the parameters. I tried something like the following, but had to give up cause I simply couldn't figure out how to do it.

    Please Login or Register  to view this content.
    or

    Please Login or Register  to view this content.
    Last edited by timtim89; 02-24-2013 at 01:01 PM.

+ 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