+ Reply to Thread
Results 1 to 7 of 7

Getting data from another sheet using dates & description as criteria.

  1. #1
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Getting data from another sheet using dates & description as criteria.

    Hi

    As my title says, i'd like using 3 criteria(start date,end date, description) in my second sheet to get data that match these criteria from another sheet.

    I can do this using formulae, but as the range in first sheet will be big(5000-15000 rows), my pc will be too slow for all these calculations.

    I'd like to use this in pc that use Excel 2003.

    Any idea to do this using code?

    Thanks in advance.
    Attached Files Attached Files
    Last edited by Fotis1991; 12-27-2012 at 09:42 AM.
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,433

    Re: Getting data from another sheet using dates & description as criteria.

    You ca use a recorded macro for an Advanced Filter. The code here is slightly edited but is based on a recorded macro.

    Please Login or Register  to view this content.

    See the attached example.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Getting data from another sheet using dates & description as criteria.

    Apologize for the delay. Really hard day....

    I have issues to get it to work in my real workbook. I get an run -time error 1004 ! and this part of code is highlight yellow!
    ..AdvancedFilter _
    Action:=xlFilterCopy, _
    CriteriaRange:=Sheets("Sheet2").Range("v1:x2"), _
    CopyToRange:=Sheets("Sheet2").Range("A5:C5"), _
    Unique:=False
    V1:X2 IS THE AREA a1:c2 of your sheet

    I suspect that i do something wrong with the advanced filter...

    What do you mean when (in your instuctions) saying :

    Then use an Advanced Filter
    You can refer back to the selection cells
    (moved to E1 to G3)

  4. #4
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Getting data from another sheet using dates & description as criteria.

    Aplogize. As i said it's a hard day!!

    No headers. This was the problem.

    Than you very mutch!

  5. #5
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,433

    Re: Getting data from another sheet using dates & description as criteria.

    You're welcome. Thanks for the rep.

    I'm sorry, I probably should have left your input area where it was ... but I didn't, I moved it so that I could use the original area for the filter criteria. That needed to be transposed (columns to rows). Then the criteria cells have a formula to pick up the values from the input area. The formula for the start date is =">=" & F1 but note that BOTH date headings are just "Date" rather than Start Date and End Date.

    Hope this is clear. Sounds as though you have it working now.

    Best wishes for the New Year!

    Regards, TMS

  6. #6
    Forum Expert mike7952's Avatar
    Join Date
    12-17-2011
    Location
    Florida
    MS-Off Ver
    Excel 2007, Excel 2016
    Posts
    3,520

    Re: Getting data from another sheet using dates & description as criteria.

    Heres another

    Please Login or Register  to view this content.
    Thanks,
    Mike

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved.

  7. #7
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Getting data from another sheet using dates & description as criteria.

    Mike.

    Of course this also works perfectly!

    Thank you.

+ 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