+ Reply to Thread
Results 1 to 4 of 4

SumProducts on a spreadsheet with a variable row dataset

  1. #1
    NJP
    Guest

    SumProducts on a spreadsheet with a variable row dataset

    I import data to a name range with MS query; the number of rows in the range
    varies with each month import. I have multiple SumProduct formulas across
    the columns.

    I know I can use code to replace the bottom of the range reference in each
    column's by finding the end of my named reference. However, I'd prefer to
    use an offset or cell function instead of having to run a macro with each
    query refresh.

    Examples of what works
    SUMPRODUCT((d5:d1152<>"")/COUNTIF(d5:d1152,d5:d1152&""))


    Examples of what doesn't
    SUMPRODUCT(("D5:D"&C1<>"")/COUNTIF("D5:D"&C1,"D5:D"&C1&""))
    where the c1 contains =rows(MTL)-1
    where MTL is my named range
    --
    Any assistance is appreciated,
    Thanks
    Nita J. Perez

  2. #2
    Tom Ogilvy
    Guest

    Re: SumProducts on a spreadsheet with a variable row dataset

    =SUMPRODUCT((INDIRECT("D5:D"&C1)<>"")/COUNTIF(INDIRECT("D5:D"&C1),INDIRECT("
    D5:D"&C1)&""))

    --
    Regards,
    Tom Ogilvy

    "NJP" <[email protected]> wrote in message
    news:[email protected]...
    > I import data to a name range with MS query; the number of rows in the

    range
    > varies with each month import. I have multiple SumProduct formulas

    across
    > the columns.
    >
    > I know I can use code to replace the bottom of the range reference in each
    > column's by finding the end of my named reference. However, I'd prefer to
    > use an offset or cell function instead of having to run a macro with each
    > query refresh.
    >
    > Examples of what works
    > SUMPRODUCT((d5:d1152<>"")/COUNTIF(d5:d1152,d5:d1152&""))
    >
    >
    > Examples of what doesn't
    > SUMPRODUCT(("D5:D"&C1<>"")/COUNTIF("D5:D"&C1,"D5:D"&C1&""))
    > where the c1 contains =rows(MTL)-1
    > where MTL is my named range
    > --
    > Any assistance is appreciated,
    > Thanks
    > Nita J. Perez




  3. #3
    NJP
    Guest

    Re: SumProducts on a spreadsheet with a variable row dataset

    Tom,

    Thanks - That works perfectly - I had tried indirect but missed the
    parenthesis prior to the &"".
    --
    Nita J. Perez


    "Tom Ogilvy" wrote:

    > =SUMPRODUCT((INDIRECT("D5:D"&C1)<>"")/COUNTIF(INDIRECT("D5:D"&C1),INDIRECT("
    > D5:D"&C1)&""))
    >
    > --
    > Regards,
    > Tom Ogilvy
    >
    > "NJP" <[email protected]> wrote in message
    > news:[email protected]...
    > > I import data to a name range with MS query; the number of rows in the

    > range
    > > varies with each month import. I have multiple SumProduct formulas

    > across
    > > the columns.
    > >
    > > I know I can use code to replace the bottom of the range reference in each
    > > column's by finding the end of my named reference. However, I'd prefer to
    > > use an offset or cell function instead of having to run a macro with each
    > > query refresh.
    > >
    > > Examples of what works
    > > SUMPRODUCT((d5:d1152<>"")/COUNTIF(d5:d1152,d5:d1152&""))
    > >
    > >
    > > Examples of what doesn't
    > > SUMPRODUCT(("D5:D"&C1<>"")/COUNTIF("D5:D"&C1,"D5:D"&C1&""))
    > > where the c1 contains =rows(MTL)-1
    > > where MTL is my named range
    > > --
    > > Any assistance is appreciated,
    > > Thanks
    > > Nita J. Perez

    >
    >
    >


  4. #4
    Registered User
    Join Date
    01-16-2006
    Posts
    15

    SumProducts on a Spreadsheet with a variable row dataset

    Just wondering, have you considered having the sums at the top of the page instead of the bottom, and then just collecting the sums below? That way, the variable row issue isn't.
    L. J. Smith
    [email protected]
    Common sense isn't.

+ 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