+ Reply to Thread
Results 1 to 8 of 8

SumProduct Question

  1. #1
    syrac
    Guest

    SumProduct Question

    This what I am looking to do. My data source is a SQL database.

    I have a query with three fields. I want to get counts on three criteria, I
    have the two working find, now need the date.
    =SUMPRODUCT((Sheet1!$A$2:$A$10000 = $A6) * (Sheet1!$D$2:$D$10000 = "EMAIL"))
    This works fine.

    The other field from Sheet1 that I want to check is a date field in the
    following format.

    6/15/2005 9:13


    I want my report to be monthly, so I would like it check for $A6 and EMAIL
    above and in my example, month of June data only.
    Something like Month(data from Sheet1) = 6. I really don't want to use a
    helper column if not necessary.

    =SUMPRODUCT((Sheet1!$A$2:$A$10000 = $A6) * (Sheet1!$D$2:$D$10000 = "EMAIL")
    * (Sheet1$C$2:$C$1000 = MONTH( not sure after this)

    Thanks




  2. #2
    Bob Phillips
    Guest

    Re: SumProduct Question

    =SUMPRODUCT(--(Sheet1!$A$2:$A$10000 = $A6),--(Sheet1!$D$2:$D$10000 =
    "EMAIL"),--(TEXT(Sheet1$C$2:$C$1000,"mmm")="Jun"))


    --
    HTH

    Bob Phillips

    "syrac" <[email protected]> wrote in message
    news:%[email protected]...
    > This what I am looking to do. My data source is a SQL database.
    >
    > I have a query with three fields. I want to get counts on three criteria,

    I
    > have the two working find, now need the date.
    > =SUMPRODUCT((Sheet1!$A$2:$A$10000 = $A6) * (Sheet1!$D$2:$D$10000 =

    "EMAIL"))
    > This works fine.
    >
    > The other field from Sheet1 that I want to check is a date field in the
    > following format.
    >
    > 6/15/2005 9:13
    >
    >
    > I want my report to be monthly, so I would like it check for $A6 and EMAIL
    > above and in my example, month of June data only.
    > Something like Month(data from Sheet1) = 6. I really don't want to use a
    > helper column if not necessary.
    >
    > =SUMPRODUCT((Sheet1!$A$2:$A$10000 = $A6) * (Sheet1!$D$2:$D$10000 =

    "EMAIL")
    > * (Sheet1$C$2:$C$1000 = MONTH( not sure after this)
    >
    > Thanks
    >
    >
    >




  3. #3
    syrac
    Guest

    Re: SumProduct Question

    Hi Bob,

    I tried your formula and it is giving me an error (that was the message two)



    "Bob Phillips" <[email protected]> wrote in message
    news:[email protected]...
    > =SUMPRODUCT(--(Sheet1!$A$2:$A$10000 = $A6),--(Sheet1!$D$2:$D$10000 =
    > "EMAIL"),--(TEXT(Sheet1$C$2:$C$1000,"mmm")="Jun"))
    >
    >
    > --
    > HTH
    >
    > Bob Phillips
    >
    > "syrac" <[email protected]> wrote in message
    > news:%[email protected]...
    > > This what I am looking to do. My data source is a SQL database.
    > >
    > > I have a query with three fields. I want to get counts on three

    criteria,
    > I
    > > have the two working find, now need the date.
    > > =SUMPRODUCT((Sheet1!$A$2:$A$10000 = $A6) * (Sheet1!$D$2:$D$10000 =

    > "EMAIL"))
    > > This works fine.
    > >
    > > The other field from Sheet1 that I want to check is a date field in the
    > > following format.
    > >
    > > 6/15/2005 9:13
    > >
    > >
    > > I want my report to be monthly, so I would like it check for $A6 and

    EMAIL
    > > above and in my example, month of June data only.
    > > Something like Month(data from Sheet1) = 6. I really don't want to use

    a
    > > helper column if not necessary.
    > >
    > > =SUMPRODUCT((Sheet1!$A$2:$A$10000 = $A6) * (Sheet1!$D$2:$D$10000 =

    > "EMAIL")
    > > * (Sheet1$C$2:$C$1000 = MONTH( not sure after this)
    > >
    > > Thanks
    > >
    > >
    > >

    >
    >




  4. #4
    JE McGimpsey
    Guest

    Re: SumProduct Question

    Change $C$1000 to $C$10000

    all arrays must be the same size.

    In article <[email protected]>,
    "syrac" <[email protected]> wrote:

    > Hi Bob,
    >
    > I tried your formula and it is giving me an error (that was the message two)
    >
    >
    >
    > "Bob Phillips" <[email protected]> wrote in message
    > news:[email protected]...
    > > =SUMPRODUCT(--(Sheet1!$A$2:$A$10000 = $A6),--(Sheet1!$D$2:$D$10000 =
    > > "EMAIL"),--(TEXT(Sheet1$C$2:$C$1000,"mmm")="Jun"))


  5. #5
    syrac
    Guest

    Re: SumProduct Question

    Fixed that already, still getting the formula error


    "JE McGimpsey" <[email protected]> wrote in message
    news:[email protected]...
    > Change $C$1000 to $C$10000
    >
    > all arrays must be the same size.
    >
    > In article <[email protected]>,
    > "syrac" <[email protected]> wrote:
    >
    > > Hi Bob,
    > >
    > > I tried your formula and it is giving me an error (that was the message

    two)
    > >
    > >
    > >
    > > "Bob Phillips" <[email protected]> wrote in message
    > > news:[email protected]...
    > > > =SUMPRODUCT(--(Sheet1!$A$2:$A$10000 = $A6),--(Sheet1!$D$2:$D$10000 =
    > > > "EMAIL"),--(TEXT(Sheet1$C$2:$C$1000,"mmm")="Jun"))




  6. #6
    JE McGimpsey
    Guest

    Re: SumProduct Question

    In article <u0r#[email protected]>,
    "syrac" <[email protected]> wrote:

    > Fixed that already, still getting the formula error


    Would have been helpful to state that...

    Did you also fix the


    Sheet1$C$2

    by changing it to

    Sheet1!$C$2

    ??

    If so, that formula works for me.

  7. #7
    Aladin Akyurek
    Guest

    Re: SumProduct Question

    syrac wrote:
    > This what I am looking to do. My data source is a SQL database.
    >
    > I have a query with three fields. I want to get counts on three criteria, I
    > have the two working find, now need the date.
    > =SUMPRODUCT((Sheet1!$A$2:$A$10000 = $A6) * (Sheet1!$D$2:$D$10000 = "EMAIL"))
    > This works fine.
    >
    > The other field from Sheet1 that I want to check is a date field in the
    > following format.
    >
    > 6/15/2005 9:13
    >
    >
    > I want my report to be monthly, so I would like it check for $A6 and EMAIL
    > above and in my example, month of June data only.
    > Something like Month(data from Sheet1) = 6. I really don't want to use a
    > helper column if not necessary.
    >
    > =SUMPRODUCT((Sheet1!$A$2:$A$10000 = $A6) * (Sheet1!$D$2:$D$10000 = "EMAIL")
    > * (Sheet1$C$2:$C$1000 = MONTH( not sure after this)
    >
    > Thanks
    >
    >
    >


    =SUMPRODUCT((Sheet1!$A$2:$A$10000=$A6)+0,(Sheet1!$D$2:$D$10000="EMAIL")+0,(INT(Sheet1!$C$2:$C$10000-DAY(Sheet1!$C$2:$C$10000)+1)=$B6)+0)

    where B6 houses a month/year of interest, set up as a first day date,
    e.g., 6/1/2005 for June 2005.
    --

    [1] The SumProduct function should implicitly coerce the truth values to
    their Excel numeric equivalents.
    [2] The lookup functions should have an optional argument for the return
    value, defaulting to #N/A in its absence.

  8. #8

    Re: SumProduct Question


    syrac wrote:
    > This what I am looking to do. My data source is a SQL database.
    >
    > I have a query with three fields. I want to get counts on three criteria, I
    > have the two working find, now need the date.


    Didn't you say you were using SQL?

    SELECT SUM(some_column) AS return_vale FROM MyTable WHERE other_colmn =
    'EMAIL' AND another_column = <<value from A6 here>>

    SELECT SUM(some_column) AS return_vale FROM MyTable WHERE other_colmn =
    'EMAIL' AND MONTH(date_colmn) = MONTH(CURRENT_TIMESTAMP)

    You could create a view on the database server to group the data. You
    could create a proc on the server to pass the cell value. You could
    create a join on the server between your table and your worksheet. You
    could write queries in Excel using just the base tables in the
    database. Make the database do the work so you don't have to.


+ 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