+ Reply to Thread
Results 1 to 10 of 10

Sumproduct with a date range and contains query

  1. #1
    Registered User
    Join Date
    10-31-2009
    Location
    Bristol
    MS-Off Ver
    Excel 2002
    Posts
    4

    Sumproduct with a date range and contains query

    Hi all,

    Okay, may be a easy solution but this has been driving me nuts as a novice.

    I have a three column bank statement which follows:

    Column a = date of transaction
    column b = description of transaction (normally a line of text)
    column c = amount

    Now on a separate worksheet in the same document i want to be able to run a formula that returns a value for the amount spent in a certain date range on particular types of transaction.

    For example:

    - Value returned for wages spent in march
    - Value returned for atm withdrawls in march.

    For example I may have transactions described as "BILL PAYMENT TO J DENNEY WAGE REFERENCE J Denney MANDATE NO 0013"on the statement. So as well as the date range query I would want to run the query with 'contains' "denney wage". Now this is where i get stuck, as i have no idea how to run a contains formula, rather than equals. Especially one that allows me to search for a part string of text rather than exact.

    Any help appreciated.

    Ta

    James

  2. #2
    Valued Forum Contributor JeanRage's Avatar
    Join Date
    03-02-2009
    Location
    Nice, France
    MS-Off Ver
    Excel 2003
    Posts
    705

    Re: Sumproduct with a date range and contains query

    Hi,

    You can try the Search() function ...
    =Search("denney wage",A1,1)

    HTH

  3. #3
    Registered User
    Join Date
    10-31-2009
    Location
    Bristol
    MS-Off Ver
    Excel 2002
    Posts
    4

    Re: Sumproduct with a date range and contains query

    ta for that.

    How would i incorpraote that into a formula that also searchs for a particular date range?

    Cheers

  4. #4
    Valued Forum Contributor JeanRage's Avatar
    Join Date
    03-02-2009
    Location
    Nice, France
    MS-Off Ver
    Excel 2003
    Posts
    705

    Re: Sumproduct with a date range and contains query

    Hi,

    You do need to test it ...
    Please Login or Register  to view this content.
    HTH

  5. #5
    Registered User
    Join Date
    10-31-2009
    Location
    Bristol
    MS-Off Ver
    Excel 2002
    Posts
    4

    Re: Sumproduct with a date range and contains query

    okay i'm a real novice and have tried:

    IF(ISNUMBER(SEARCH(statement!"denney wage",b2:b16000),SUMPRODUCT(Statement!a2:a16000>=05/04/09),(Statement!a2:a16000<=30/04/09),--(Statement!C2:C16000)))

    Any ideas what needs correcting?

    b2:b16000 being the description column
    a2:a16000 being the date column
    c2:c16000 being the amount column

    Statement is the main worksheet and summary is the worksheet where i want the results.

    Can you believe I'm doing this on a saturday night ;-)

    Cheers

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

    Re: Sumproduct with a date range and contains query

    Try like this

    =SUMPRODUCT(ISNUMBER(SEARCH("denney wage",Statement!B2:B16000))*(Statement!A2:A16000>="05/04/09"+0)*(Statement!A2:A16000<="30/04/09"+0),Statement!C2:C16000)

  7. #7
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: Sumproduct with a date range and contains query

    With
    On Sheet1...
    A2:A50 contains dates
    B2:B50 contains descriptions
    C2:C50 contains amounts

    and...
    On Sheet2
    A1: (a date.....eg 03-MAR-2009)
    A2: (a key phrase to find.....eg Charlie Wage)

    This formula returns the total amounts from Sheet1
    where the dates are in the same month as the date A1
    and the key phrase is found in the description

    Please Login or Register  to view this content.
    In the above example, the total is returned
    for all dates in MAR 2009 where the description contains "Charlie wage".

    Is that something you can work with?
    Ron
    Former Microsoft MVP - Excel (2006 - 2015)
    Click here to see the Forum Rules

  8. #8
    Registered User
    Join Date
    10-31-2009
    Location
    Bristol
    MS-Off Ver
    Excel 2002
    Posts
    4

    Re: Sumproduct with a date range and contains query

    Blooming brilliant...all working! If only i posted this ealier i wouldn't of spent all day scratching my head. Thanks!

    Cheers

    James

  9. #9
    Registered User
    Join Date
    04-24-2020
    Location
    Malaysia
    MS-Off Ver
    3
    Posts
    9

    Re: Sumproduct with a date range and contains query

    sorry to interrupt , may i know using this formula for the same date ?

  10. #10
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,939

    Re: Sumproduct with a date range and contains query

    Quote Originally Posted by Minci33 View Post
    sorry to interrupt , may i know using this formula for the same date ?
    Administrative Note:

    Welcome to the forum.

    We are happy to help, however whilst you feel your request is similar to this thread, experience has shown that things soon get confusing when answers refer to particular cells/ranges/sheets which are unique to your post and not relevant to the original.

    Please see Forum Rule #4 about hijacking and start a new thread for your query.

    If you are not familiar with how to start a new thread see the FAQ: How to start a new thread
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

+ 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