+ Reply to Thread
Results 1 to 4 of 4

Extract data between two dates

Hybrid View

  1. #1
    Registered User
    Join Date
    01-20-2011
    Location
    Bulgaria
    MS-Off Ver
    Excel 2003
    Posts
    34

    Extract data between two dates

    I have a long list (3 cols) - date, value, remark. I’d like to extract data between two dates in a separate table in another sheet. There is Start date and End Date. Every time I change start and end date, a table to be formed in other sheet. What formula to use? Example attached
    Thanks in advance
    Attached Files Attached Files
    Last edited by grey_hair; 04-21-2011 at 03:58 AM.

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Extract data between two dates

    Assuming your start and end dates are in Sheet1, A2:B2, then in Sheet2, D2 add a helper column with formula:

    =IF(AND(A2>=Sheet2!$A$2,A2<=Sheet2!$B$2),COUNT(D$1:D1)+1,"")

    copied down. This indexes the matching items.

    in E2 enter:

    =MAX(D:D)

    this gives count of matches.

    Now in Sheet1, C2 enter:

    =IF(ROWS($A$1:$A1)>Sheet1!$E$2,"",INDEX(Sheet1!A:A,MATCH(ROWS($A$1:$A1),Sheet1!$D:$D)))

    copied down as far as you need and across the 3 columns.
    Attached Files Attached Files
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Registered User
    Join Date
    01-20-2011
    Location
    Bulgaria
    MS-Off Ver
    Excel 2003
    Posts
    34

    Re: Extract data between two dates

    Soory, but I'm comimng back with my problem.
    The formulas in the given solution work only in certain specific cases-not for all. For instance everything is OK for the period 1.4.2001-7.4.2001, but that is all. No solution for other periods - say 1.4.2001-4.5.2002. In the Sheet1 correctly 5 records are shown but in Sheet2 something goes wrong-no require table is written. Same for other random periods.
    I did exactly everything shown in given solution bot not result.
    So please help me again
    Sample attached
    Thanks in advance for your suggestions ot different solution
    Attached Files Attached Files

  4. #4
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Extract data between two dates

    You need to copy down the formulas in C, D and E down further to capture any more results... right now you have limited it to 3 rows only.
    Attached Files Attached Files

+ 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