+ Reply to Thread
Results 1 to 9 of 9

data from date range

  1. #1
    Registered User
    Join Date
    03-20-2010
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2007
    Posts
    13

    data from date range

    Hi,

    I'm a beginner with excel and am trying to set up a spreadsheet.

    On spreadsheet 1 I have a column that is the date and another column is how much I made.

    On spreadsheet 2 I have two cells in which I want to input a "date from" and a "date to".

    When I input dates into these cells on spreadsheet 2 I would like to be able to click on a button that will look up how much I made between these two dates and then output the value in another cell on spreadsheet 2.

    I understand that I need to create a button and then assign a macro to it.

    If anyone could help me with the vba code for this I would greatly appreciate it.

    Regards
    schi13

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: data from date range

    You don't need VBA to do this, the alternatives would be possibly a PivotTable or AutoFilter with the Subtotal Function. Attach an example workbook
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Registered User
    Join Date
    03-20-2010
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2007
    Posts
    13

    Re: data from date range

    Hi,

    Please find example workbook attached. I have provided comments for your information.

    Regards
    Simon
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    03-20-2010
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2007
    Posts
    13

    Re: data from date range

    By the way, I would prefer to do this via VBA code.

  5. #5
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: data from date range

    It should be done with formulas

  6. #6
    Registered User
    Join Date
    03-20-2010
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2007
    Posts
    13

    Re: data from date range

    Ok thanks could you please point me in the right direction of what kind of formulas I need to be looking at?

    Regards
    Simon

  7. #7
    Forum Expert Palmetto's Avatar
    Join Date
    04-04-2007
    Location
    South Eastern, USA
    MS-Off Ver
    XP, 2007, 2010
    Posts
    3,978

    Re: data from date range

    Here one approach. I create a couple of dynamic named ranges for the dates and sales and used then in the formula below.
    =SUMPRODUCT(--(Dates>=N2),--(Dates<=N4)*(Sales))
    Another option is to use DSUM, which requires passing the dates to criteria cells. The DFunctions are very efficient. See Excel Help on DSUM
    Attached Files Attached Files
    Palmetto

    Do you know . . . ?

    You can leave feedback and add to the reputation of all who contributed a helpful response to your solution by clicking the star icon located at the left in one of their post in this thread.

  8. #8
    Registered User
    Join Date
    03-20-2010
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2007
    Posts
    13

    Re: data from date range

    Hi Palmetto,

    Thanks for your reply. I am currently using this method however I am trying to avoid the lag when I input the dates. So I'm trying to put the dates in first then like click a button so that it runs the function then??? Any help with this would be appreciated??

    Regards
    Simon

  9. #9
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: data from date range

    If you want to avoid long calculation times each time you enter a value, turn off automatic calculation and re-calculate after you've entered all your data by hitting F9.

    Also, please update your user profile.You state you're using Excel 2003 but the file you attached was an xlsm, so obviously 2007 or later.

+ 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