2-dimensional Date Range With Dynamic Copy And Paste

  • Re: 2-dimensional Date Range With Dynamic Copy And Paste


    Hm. I have a working version of what I was talking about earlier. I was hoping to make it more dynamic--such that the system would update the cells I've been rambling on about for the past week whenever the date range changes. Instead, I have the following Macro which is called when the system is told to make a report.



    It works, but it's not exactly what I was looking for. Perhaps this, and all of the above posts/replies/samples/examples/information will help?

    Many thanks, :music:
    --epynephrin

  • Re: 2-dimensional Date Range With Dynamic Copy And Paste


    Quote from epynephrin

    I'm afraid not. Maybe I missed that part of the Pivot Table tutorial (MS Online help). Where would one tell the Pivot to use a dynamic range?


    In Step Two of the Pivot Table Wizard, Excel will ask for the range that covers the data to be used by the Pivot Table. You would type the dynamic range name you created for your data into the dialog box.


    Quote

    And, can I add participants in? I'm assuming so, because my Add Participant userform inserts a row above the first empty one for new participants--but this won't screw up the Pivot Table setup?


    The Pivot Table uses a "Dynamic" range. If you look up dynamic range names, you'll find that the reason you use a "dynamic" range is so it adjusts itself to the ever changing size of the data range - increasing or decreasing in size as needed. So, yes, you will be able to add participants without concern that they will be included in the Pivot Table.


    Quote

    Once I've gotten all that down, can I use the cells in the pivot exactly as I would any other cell in Excel (for VBA codes)?


    I'm not sure I would say that all Pivot Table cells can be used exactly like all other Excel cells so, I would have to say it depends. What do you have in mind? After you get the dynamic range set up and the Pivot Table to refer to it, you should be able to answer this question better. You may not need any VBA code.


    Jim

  • Re: 2-dimensional Date Range With Dynamic Copy And Paste


    Wow. This thread has gone on forever. It just refuses to die!


    Jim,
    I think the problem I've been having with the pivot tables is where to put what where. There are the four "areas": Data, Row, Column and Page. My assumption was Row/Header would be Site or Department, and Data would be each of the 19 classes. What I found was that as I added each class in, the table became more and more unwieldly.


    So, perhaps I'm adding the wrong pieces to the wrong place.


    Junho,
    I like where you're going! I hadn't even considered that, and it looks like it's a step in the right direction. There is one slight problem, though. Try the following steps, and see if what I did comes up on yours:

    • Go to Sheet 1, clear Cells F2, E3, and F5. (Change the data slightly)
    • Go to the 2007 Yearly Report page, and change cells D21 to 1-Jan-06 and G21 to 31-Dec-06 (make a 2006 date range)
    • Change cells D40 to 1-Jan-03 and G40 to 31-Dec-03 (Make a 2003 date range for comparison)


    What I'm seeing is that on the Report page, in the 2003 and 2006 date ranges, the Site and Department breakdown has a 2 the Lethbridge/Individual Ops boxes (cells C51 and C32), but because we changed the data in "step 1", that result should only be 1.
    That is, in the year 2003 (or 2006), only one person attended a class in Lethbridge's Individual Ops group.
    Do you have an brilliant ideas on how that can be corrected?

    Many thanks, :music:
    --epynephrin

  • Re: 2-dimensional Date Range With Dynamic Copy And Paste


    1.sheet2:delete additional rows & columns.
    2.run. create report.
    3.simple data range_ input_01/31/2006~12/31/2006
    regards,

  • Re: 2-dimensional Date Range With Dynamic Copy And Paste


    I'm afraid that still didn't work. I think the problem is that your formula:


    =SUMPRODUCT((Department=D$11)*(Site=$A13)*(First_Name>0)*($C5>0))


    is returning all results anyone working in the site and department in question, because C5 is greater than 0. Because there are two people working in Lethbridge's Individual Ops group, and the C5 result is 1, it looks like your formula is counting both people. I'm trying to get it to only count the one person who took the class.

    Many thanks, :music:
    --epynephrin

  • Re: 2-dimensional Date Range With Dynamic Copy And Paste


    I'm still a little confused by that (Although, adding the color has made it a lot clearer; there is color on mine, but I cleared it out to try and make it fit the size limit). The problem is that it looks like the formulas you've got there are really manual and labor intensive to maintain--unless I'm just misinterpreting them. (If anyone else is reading this, am I the only one who's getting lost?)


    I hate to say it, but I'm starting to think that the best way to do this is with Cringe's formula and the copy Macro that I've included at the top of page 3.


    I appreciate your help, everyone.

    Many thanks, :music:
    --epynephrin

  • Re: 2-dimensional Date Range With Dynamic Copy And Paste


    Quote

    I hate to say it, but I'm starting to think that the best way to do this...


    Unless you want to use the Pivot Table.....


    Good luck,
    Jim

  • Re: 2-dimensional Date Range With Dynamic Copy And Paste


    Quote from JimFuller1

    Unless you want to use the Pivot Table.....


    Good luck,
    Jim


    I tried. I still haven't figured it out. I assume that I need to put Site under Rows and Dept under Columns (or vice-versa). I then added each of the 17 classes in as the Data fields. What I came up with was massive and didn't really answer my question.


    By each site, I have 17 rows which each counts up a class that has been taken. I couldn't see a way add a date range to them, and I couldn't really see my data, as it fell off the screen on both sides.


    I then tried just putting in the Number of Courses Completed for Data, instead of the actual courses. It was a little more sane, but still didn't answer the question of how many people went to a class between Date X and Date Y. I'm afraid I haven't seen that in the pivots.


    Sorry, am I missing something?


    Thanks,
    --epy

    Many thanks, :music:
    --epynephrin

  • Re: 2-dimensional Date Range With Dynamic Copy And Paste


    epynephrin,


    I guess I won't be able to say how to do it unless I see the data. Can you post some useable data that we can both work with?


    Jim

  • Re: 2-dimensional Date Range With Dynamic Copy And Paste


    Quote from JimFuller1

    epynephrin,


    I guess I won't be able to say how to do it unless I see the data. Can you post some useable data that we can both work with?


    Jim


    Certainly!


    What you have there is my fake data (now with more fictional characters per serving), and the two attempts I was trying to explain. I know it looks a little weird the way it's organized, but I assure you there's some method to my madness (although mostly madness)--as I mentioned at the beginning, the actual final product is far too big for me to upload here.


    The question I'm trying to answer is: How many people from [site] [department] took any classes between [Start date] and [end date]. The start and end dates are on the Report Template I posted at the beginning of this mammoth thread, I assume that--if I can make the PivotTables do what I want them to do, they'll wind up on the hidden Workings sheet I referenced somewhere else in this thread.


    Thanks. Your help is greatly appreciated.
    --epy


    p.s. I have no idea what a Sun Code is...

  • Re: 2-dimensional Date Range With Dynamic Copy And Paste


    epynephrin,


    Soapbox Warning!!!
    I sure you thought that layout for the data made sense but, what you have done is complicate your life beyond what is necessary. You're right, there is no way to have a Pivot Table do what you want BECAUSE of the way the data is layed out. I'm sure the whole reason you're having these long posts is because of trying to work around data that is layed out wrong.


    If you just used common database layout, built in functionality like Pivot Tables would do most of what you want without effort.
    Stepping down from Soapbox...


    Sorry I couldn't help.


    Jim

  • Re: 2-dimensional Date Range With Dynamic Copy And Paste


    here's compressing table(post#29)


    regards,

  • Re: 2-dimensional Date Range With Dynamic Copy And Paste



    Maybe I've just never seen an actual Excel database layout, but based on the few I've seen I'm feeling like I've missed something. Is there a better way for me to track this whole thing, then, and I've just been too stupid the whole way along?


    I would be willing to take a look, if you were to have the time and patience to suggest it, at a better way to handle this. At the moment, I have a system that seems to work; I'm not sure it's perfect. Considering I knew nothing about VBA and a bit about Excel when I got into the project, I'm sure there's always a way to make it simpler--hopefully a little more idiot-proof than usual.


    Here's hoping I don't feel ridiculously dumb if/when I find out that there's a free Excel thing that does everything I've manually programmed for me.


    If you're thinking Access, the problem is that I don't have it available to me, which is mainly why I'm reinventing the wheel.

    Many thanks, :music:
    --epynephrin

  • Re: 2-dimensional Date Range With Dynamic Copy And Paste


    Quote from epynephrin

    Maybe I've just never seen an actual Excel database layout,


    There is one attached. It has one record for every date a course was taken. The one record tells you everything you need to know. Your layout includes more than one piece of data for each record which is causing all your problems.


    Quote

    but based on the few I've seen I'm feeling like I've missed something. Is there a better way for me to track this whole thing, then, and I've just been too stupid the whole way along?

    Don't lets start calling each other or ourselves names. The purpose of the forumn is learning and that includes me too.


    Quote

    At the moment, I have a system that seems to work; I'm not sure it's perfect. Considering I knew nothing about VBA and a bit about Excel when I got into the project, I'm sure there's always a way to make it simpler--hopefully a little more idiot-proof than usual.

    You are probably correct that changes to what you have already will seem easier than starting over. The lesson learned will not go to waste however next time you get a project to work on.


    Quote

    Here's hoping I don't feel ridiculously dumb if/when I find out that there's a free Excel thing that does everything I've manually programmed for me.

    You won't as long as you view this as an investment in learning.


    The sample I attached is short. You may want to take the data you posted and convert it all to the layout I've suggested and just run a Pivot Table on it and see if you can now get what you want, or more of what you want, before you have to do any programming with VBA. That's when the layout pays off. When you've automated all the built in functionality and have to start creating a new wheel. Let me know what you think.


    Jim

  • Re: 2-dimensional Date Range With Dynamic Copy And Paste


    Hey, Jim


    Thanks.


    No worries, I am fairly prone to self-effacing humor (and the internet isn't prone to sarcasm). I figure it is a lot better to adapt my Wheel 2.0 instead of scrapping it when I learn there's an original, too.


    So, where's the attachment?

    Many thanks, :music:
    --epynephrin

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!