+ Reply to Thread
Results 1 to 8 of 8

Need Help With SUMPRODUCT

  1. #1
    Ken Zenachon
    Guest

    Need Help With SUMPRODUCT

    I'm still learning to flex my SUMPRODUCT muscles. Here's my latest
    challenge:

    Workbook contains 2 worksheets: Sales and SaleTotals.
    Relevant columns on Sales: Sold To, Date and Sale Price (corresponding
    to letters A, D and E, respecively)
    The "Sold To" column contains the names of customers and the text "Own
    Use".

    On the SaleTotals page I want to divy up the sales by tax period, and
    for each period show how much (in dollar value) we sold and how much
    we kept for our own use.

    Columns on SalesTotal: From, Until, Sales, SalesTax, Own Use, OwnUseTax
    (corresponding to letters A-F, respectively)
    "From" and "Until" are the taxation period begin and end dates.

    Now, I came up with this fomula for cell SaleTotals!E3 to calculate the
    "Own Use" amount. It looks like it works but it sure is a heck of a
    long string. Can this be made shorter?

    =SUMPRODUCT(--(Sales!$A$2:$A$65535="Own
    Use"),--(Sales!$D$2:$D$65535>='Sales
    Totals'!$A3),--(Sales!$E$2:$E$65535))-SUMPRODUCT(--(Sales!$A$2:$A$65535="Own
    Use"),--(Sales!$D$2:$D$65535>='Sales
    Totals'!$B3),--(Sales!$E$2:$E$65535))

    (Sorry if the formula breaks across multiple lines)

    What's the most computationally efficient way to calculate the sums I
    need?

    KZ


  2. #2
    Bob Phillips
    Guest

    Re: Need Help With SUMPRODUCT

    Try this

    =SUMPRODUCT(--(Sales!$A$2:$A$65535=E$1),--(Sales!$D$2:$D$65535>=$A3),--(Sale
    s!$D$2:$D$65535<=$B3),--(Sales!$E$2:$E$65535))

    --

    HTH

    Bob Phillips

    (remove nothere from the email address if mailing direct)

    "Ken Zenachon" <[email protected]> wrote in message
    news:[email protected]...
    > I'm still learning to flex my SUMPRODUCT muscles. Here's my latest
    > challenge:
    >
    > Workbook contains 2 worksheets: Sales and SaleTotals.
    > Relevant columns on Sales: Sold To, Date and Sale Price (corresponding
    > to letters A, D and E, respecively)
    > The "Sold To" column contains the names of customers and the text "Own
    > Use".
    >
    > On the SaleTotals page I want to divy up the sales by tax period, and
    > for each period show how much (in dollar value) we sold and how much
    > we kept for our own use.
    >
    > Columns on SalesTotal: From, Until, Sales, SalesTax, Own Use, OwnUseTax
    > (corresponding to letters A-F, respectively)
    > "From" and "Until" are the taxation period begin and end dates.
    >
    > Now, I came up with this fomula for cell SaleTotals!E3 to calculate the
    > "Own Use" amount. It looks like it works but it sure is a heck of a
    > long string. Can this be made shorter?
    >
    > =SUMPRODUCT(--(Sales!$A$2:$A$65535="Own
    > Use"),--(Sales!$D$2:$D$65535>='Sales
    >

    Totals'!$A3),--(Sales!$E$2:$E$65535))-SUMPRODUCT(--(Sales!$A$2:$A$65535="Own
    > Use"),--(Sales!$D$2:$D$65535>='Sales
    > Totals'!$B3),--(Sales!$E$2:$E$65535))
    >
    > (Sorry if the formula breaks across multiple lines)
    >
    > What's the most computationally efficient way to calculate the sums I
    > need?
    >
    > KZ
    >




  3. #3
    Ken Zenachon
    Guest

    Re: Need Help With SUMPRODUCT

    Bob, I'm not sure what you did in the first argument,
    (Sales!$A$2:$A$65535=E$1) What's E1 got to do with anything?

    KZ


  4. #4
    Ken Zenachon
    Guest

    Re: Need Help With SUMPRODUCT

    I just changed "E$1" to "Own Use" and it works fine.
    Still, put a dozen or so of these formulas on a page and it takes a
    couple of seconds for the sheet to update every time I enter a new
    record.
    I'm running an Athlon XP 2600+ with 1GB of generic RAM. You'd think a
    few simple math calculations wouldn't cause a fast CPU to skip a beat,
    and yet it does.
    Oh well.


    ]-[


  5. #5
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675
    Ken,

    Do you really have data in all rows?

    It may be quicker if you limit the scope of the formula

  6. #6
    Ken Zenachon
    Guest

    Re: Need Help With SUMPRODUCT

    Yeah, I just noticed that I defaulted from rows 2 to 65,535. I limited
    the scope and the refreshes sped up, although calculations still take
    longer than I would think is necessary.

    KZ


  7. #7
    Bob Phillips
    Guest

    Re: Need Help With SUMPRODUCT

    E$1 is the heading, which should say 'Own Use'

    --

    HTH

    Bob Phillips

    (remove nothere from the email address if mailing direct)

    "Ken Zenachon" <[email protected]> wrote in message
    news:[email protected]...
    > Bob, I'm not sure what you did in the first argument,
    > (Sales!$A$2:$A$65535=E$1) What's E1 got to do with anything?
    >
    > KZ
    >




  8. #8
    Ken Zenachon
    Guest

    Re: Need Help With SUMPRODUCT

    Sorry, miscommunication on my part--
    The column heading was actually "Sold To", not "Own Use".
    My fault.

    Thanks for you help, Bob!


    ]-[


+ 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