+ Reply to Thread
Results 1 to 7 of 7

Selecting Pivot Items between set dates

  1. #1
    Registered User
    Join Date
    06-21-2010
    Location
    Norwich, England
    MS-Off Ver
    Excel 2003
    Posts
    13

    Selecting Pivot Items between set dates

    Hi,

    I have a pivot table with data imported from another spreadsheet source on a weekly basis. The pivot displays Sales Rep name, created (a date & time value) down the left hand side and revenue summed in the table area.
    Each monday i want to update the pivot table with new data and only display the rows with dates for the previous week. e.g. for this week show dates between 14/06/2010 and 20/06/2010. The report will normally be created on the monday of the following week so maybe something using today () -7 extra.

    I had a go and go pretty close using cell values as the days I wanted to display but have lost the code.

    Any Ideas?

    Thanks

  2. #2
    Registered User
    Join Date
    06-21-2010
    Location
    Norwich, England
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: Selecting Pivot Items between set dates

    I have been able to change the dates to just date with no time. is there a way of getting all pivot items between two dates?

  3. #3
    Registered User
    Join Date
    06-21-2010
    Location
    Norwich, England
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: Selecting Pivot Items between set dates

    i tried the code below and it worked when i manually entered a date where i have written "date()" but using date() does not work. Have I got the code slightley wrong? Or can I use a input box to get the user to enter a date range, or perhaps just look up a value in the spreadsheet?

    Please Login or Register  to view this content.

  4. #4
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,987

    Re: Selecting Pivot Items between set dates

    Your code is currently testing against the literal string "date()" - you need to remove the quotes. I'd also explicitly convert the item name to a date using CDate:
    Please Login or Register  to view this content.
    Everyone who confuses correlation and causation ends up dead.

  5. #5
    Registered User
    Join Date
    06-21-2010
    Location
    Norwich, England
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: Selecting Pivot Items between set dates

    Thanks that works but i get a run time error '13' type missmatch then the second half does not work and has the same error, even if i comment out the first half


    Please Login or Register  to view this content.

  6. #6
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,987

    Re: Selecting Pivot Items between set dates

    Then I'd guess you have some blanks or non-date values in the field. There's also no point in looping twice through the same data:
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    06-21-2010
    Location
    Norwich, England
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: Selecting Pivot Items between set dates

    thanks thats great

+ 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