+ Reply to Thread
Results 1 to 41 of 41

How to Change values by increment in Data Table

  1. #1
    Registered User
    Join Date
    05-26-2009
    Location
    new york
    MS-Off Ver
    Excel 2007
    Posts
    76

    How to Change values by increment in Data Table

    Hello,

    I have built a model which aims to calculate various information/statistics based upon 2 inputs which I can change (see 'Mov_Avg_Chart' tab cells C6 and C8). In cell C6 I have identified the moving average period that I would like, and in cell C8 the period for moving average of the gradient/standard deviation of the gradient.

    I have created 4 data tables (one for annualized return, sharpe ratio,max drawdown, and annualized risk/reward). The first data table can be seen in cells AE15:AH18. In cells AE16:AE18, there are the moving average period inputs (as in cell C6) and in cells AF 16,AG16 and AH 16 are the moving average gradient inputs (as in cell C8). What I am trying to do is create a table that will allow me to state a minimum moving average period (as in C6) and a maximum moving average period (as in C6), and an increment which I would like to look at the data in. Thus, in this example, the minimum moving average period would be 20, the maximum would be 40 and the increment would be 10. Also, I want to create a minimum moving average gradient (as in C8) and a maximum moving average gradient (as in C8) and an increment figure. Thus, in this example, it would be minimum of 75, maximum of 125 and an increment of 25. The point in the example is to see which outcomes based on the inputs are the most favorable.

    I am having difficulty with setting up a minimum and maximum range and the incremental period. The trouble is, I don't know how to put these as additional inputs and have them drop into the data table (in place of cells AE16 to AE18 for example). Would anyone have any ideas? Also, the automated recalculation of the data table is needlessly slowing down the spreadsheet; is there a way that the data table can be recalculated only when there are changes to the input functions? I have set the calculation method to 'automatic except data tables' because otherwise it takes 15 minutes for the file to open. Thus, the data table isn't calculating automatically. That is, cells C6, C8 and the minimum and maximum range cells that I am seeking to create? Would someone be able to help me with this?

    Kind Regards,

    Maani

    (I have tried to zip the file and attach it but it kept giving me the upload file failed error. Thus, I have attached it below in a link)
    http://www.4shared.com/file/12573353...t_15_2009.html
    Last edited by maani; 08-25-2009 at 07:32 AM.

  2. #2
    Registered User
    Join Date
    05-26-2009
    Location
    new york
    MS-Off Ver
    Excel 2007
    Posts
    76

    Re: Problem with data tables

    Bump No Response

  3. #3
    Registered User
    Join Date
    05-26-2009
    Location
    new york
    MS-Off Ver
    Excel 2007
    Posts
    76

    Re: Problem with data tables

    Hi,

    As I had no responses, I figured I would try and re-state the problem in simpler terms. I have a 2-variable data table under the What-if-analysis tools. I would like to create the ability to set a minimum and maximum value for each input and the increment at which I would like to test. For example, if my minimum value for the column input is 10 and my maximum value for the column input is 50, and the increment that I select is 10, then I would like to see the 10,20,30,40,and 50 values in the column of my data table. I would like to have this ability for both the row and column inputs in the data table. I have spent the better part of the past couple of days trying to figure this out and search online but have had no luck. Would someone be able to help me with this?

    Thanks,

    Maani

  4. #4
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: How to Incremental Change values in Data Table

    Here is a generic way to do this. I haven't looked at your file.
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    05-26-2009
    Location
    new york
    MS-Off Ver
    Excel 2007
    Posts
    76

    Re: How to Incremental Change values in Data Table

    Hi Stephen,

    Thanks for your response. Based on the code provided, where would I need to put the minimum and maximum values for the column (and row), and the incremental period for each (anywhere particular on the spreadsheet)? Also, is there anywhere in particular in the Visual Basic Editor that I should put the code? I have just attached a much smaller and condensed version of my spreadsheet. You can find the 4 data table in cells AE15:AH37 of the 'Mov_Avg_chart' tab. Additionally, my partially constructed optimisation table is in cells A21:B27 of the 'Mov_Avg_chart' tab.

    Thanks for your time.

    Maani
    Attached Files Attached Files

  6. #6
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: How to Incremental Change values in Data Table

    Maani - can you explain a bit more what you're trying to do. I'm struggling to understand it all. Can you add your expected output based on your data?

  7. #7
    Registered User
    Join Date
    05-26-2009
    Location
    new york
    MS-Off Ver
    Excel 2007
    Posts
    76

    Re: How to Incremental Change values in Data Table

    Hi Stephen,

    The input values (cells C6 and C8) which are linked to the data table are moving average period (C6) and moving average gradient (C8). The 4 data tables are for 4 statistics that are calculated in cells AE7:AF13. I am trying to optimise the statistics based on the changing inputs (C6 and C8). For example, Data Table 1 is an optimisation for Annualized Return, where cells AE16:AE18 represent values that cell C6 would change to and cells AF15:AH15 represent values that cell C8 would change to.

    I have re-attached the spreadsheet with a formulas for AE16:AE18 and AF15:AH15 (linking them to the opimisation table in cells A21:B25). What I would like is to be able to change the values in the optimisation table and have it automatically adjust in the data tables. This is being done right now, but the issue is, the data tables only go 3 rows down and 3 rows across. There will be a point where the incremental variable (cells B23 and B25) will be such a number that the data tables will need to be increased greater than or smaller than 3 rows down and across.

    The other issue is that my actual spreadsheet is about 6mb and has quite a bit of data, thus, I had to put the calculation method on automatic except for data tables. Otherwise, it takes a long time to open the spreadsheet and make changes to it without the data tables recalculating constantly. Would you know of a way through VBA to make the data tables only recalculate when the cells in the optimisation table are changed?

    Thanks, and sorry about the lack of clarity in previous posts.

    Maani
    Attached Files Attached Files

  8. #8
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: How to Change values by increment in Data Table

    OK, I think I see now. The code I provided could be adapted to your needs I think. In effect you're saying that instead of a max value you are setting the number of rows/cols in your tables(?) But what determines this - would it be viable to put it in a cell (which the code could then reference)?

    Re calculation query, this is not tested but set calculation to manual and add these lines to your worksheet change code:
    Please Login or Register  to view this content.
    Btw, it's probably not relevant to solving your question but what is the TABLE formula? Is it a new xl2007 one?

  9. #9
    Registered User
    Join Date
    05-26-2009
    Location
    new york
    MS-Off Ver
    Excel 2007
    Posts
    76

    Re: How to Change values by increment in Data Table

    Hi Stephen,

    Thanks for your response. The TABLE formula is part of the Data Table calculation. In excel 2007, under the data tab, then what-if-analysis, you select data table, and highlight the entire data table (my first data table for example are cells AE15:AH18); then it asks you what your column and row input are. In my case, it is cells C6 and C8. What it is doing is calculating other scenarios and the results based on those inputs (C6 and C8) changing to the values that are in the row (AE16:AE18) and column headings (AF15:AH15) in the data table. So, it is a matrix of sorts that shows me the various results if I optimise my inputs. For some reason the formulas in the data table show up as an array formula with TABLE. However, it is not a formula in itself as far as I know; just something that comes into the cells when you use data tables.

    With regard to the setting of the row/column values in my data tables (in this case 3 rows down and 3 columns across), it is a totally random. That is, the numbers of rows/columns will depend on the minimum value in the optimisation table (see cells B22 and B24) and the increment with which I want to see the data (see cells B23 and B25). Ideally, I would like to set a minimum and maximum value and an increment. For example, I may specify the minimum value as 10 and the maximum as 50, and the increment as 10. In this situation, it would show me 5 rows going down in the data table (10,20,30,40,50). The reason I have left out maximum in the optimsation table is because I do not know how to automate the data table while including maximum in the optimsation table (I have simply linked it via formulas). That is why I thought that code would perhaps be a better way to go about this.

    With this in mind, would the code you provided be a suitable option for me? I am a novice at code and thus am still not too comfortable with the in's and out's of it all.

    Thanks for your patience,

    Maani
    Last edited by maani; 08-19-2009 at 06:30 AM.

  10. #10
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: How to Change values by increment in Data Table

    I'm attaching a slimmed-down version of your workbook. Press the button to populate the table - you'll see I've updated the optimisation table with max values so those all need to be filled in first. I've put the output table on a separate sheet to avoid space issues, but it appears that the data table row/col inputs have to be on the same sheet so I have put them in Q1 and Q2. If that's OK, you could move them to the last column or somewhere else never likely to interfere with any table. I must say I don't really understand the data tables as I have not used 2007 much - atm my tables fill every cell with the same number!
    Please Login or Register  to view this content.
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    05-26-2009
    Location
    new york
    MS-Off Ver
    Excel 2007
    Posts
    76

    Re: How to Change values by increment in Data Table

    Hello Stephen,

    Thanks for your response and for providing the code. When I downloaded your file, it said that excel opened the file by removing certain elements, so I'm not sure I am seeing everything you did. However, when I recreated what you did in my spreadsheet, I was unable to get the data to populate.

    I went into the Visual Basic Editor, added a new module and put in the code you provided. Additionally, I copied your optimisation table and copied the 'press me' button as well. I set Q1 and Q2 equal to cells C8 and C6. However, I could not get the correct data to populate. Should I be filling in cell A1 in Sheet 2 to the statistic that I am seeking or just leave it empty? I have put A1 equal to the annualized return statistic because that is the statistic that I want to optimise. However, the cells inside the data table simply equal the value of cell A1 even though the formula including TABLE is in the cells. Would you be able to explain what further I am supposed to do to get the data to populate? Or perhaps send a different version of your excel file?

    Also, will this populate for four data tables?

    Thanks,

    Maani
    Last edited by maani; 08-19-2009 at 08:19 AM.

  12. #12
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: How to Change values by increment in Data Table

    Strange, can you get this one to work?

    Or try this 2003 version - I'm floundering here really! If neither of these work, try attaching the file you worked up and I'll see if I can figure it out that way.
    Attached Files Attached Files
    Last edited by StephenR; 08-19-2009 at 08:17 AM.

  13. #13
    Registered User
    Join Date
    05-26-2009
    Location
    new york
    MS-Off Ver
    Excel 2007
    Posts
    76

    Re: How to Change values by increment in Data Table

    Hi Stephen,

    Thanks for reattaching. I have received the same error when I open both files. That is, the information is unreadable. I have attached my file.

    I have left my data tables in (as a comparison see AE15:AH18 in 'Mov_Avg_Chart'. The values in AF16:AH18 vary depending on the row (AE16:AE18) and column inputs (AF15:AH15). Thus, the values are all different. However, when I hit the press me button, and go to Sheet2, the values that populate are all the same as cell A1 (the statistic that I want to optimise) in Sheet2. That is, there is no change in values. Have I missed a part of your spreadsheet that didn't load properly?

    Also, what do I need to do to have this come up for the other 3 data tables (4 in total)?

    Thanks again,

    Maani
    Attached Files Attached Files

  14. #14
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: How to Change values by increment in Data Table

    OK, it seems the code is working up to a point and doing everything I expected.

    I'm aware the values are all the same, as I mentioned, but what I'm not clear about is how you managed to get different values in each cell of your table. We seem to be using the same formula. Do you know what else you might have done because it seems all one does is enter a row input and a column input? I can't figure out what it is that would make the values different.

    Let's think about the others once we've sorted one out!

  15. #15
    Registered User
    Join Date
    05-26-2009
    Location
    new york
    MS-Off Ver
    Excel 2007
    Posts
    76

    Re: How to Change values by increment in Data Table

    Hi Stephen,

    I am not sure how Data Tables calculate the values themselves. However, if you highlight the entire data table (in this case cells AE15:AH18 in Mov_Avg_Chart) and then go under Data»What-If Analysis»Data Tables, it will prompt you for the row and column inputs. Then, you will put in C8 for the row and C6 for the column and it updates it. The top left cell of each data table (for example cell AE15) must be set to equal the statistic you want to optimise. The formula in each of the cells {=TABLE(C8,C6)} is not a real formula has far as I can tell. It is just excel's way of calculating this through the data table tool. Is there a way to set your code to work with the data table tool? That is, if we keep the data tables I have,but use your automated process for changing the row and column headers in the data table.

    Hope this background information helps.

    Maani

  16. #16
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: How to Change values by increment in Data Table

    The code should do that as I recorded a macro. However, new issues keep cropping up. Don't take offence but are you sure that your data tables are doing what you want anyway?

    What, for example, does the value -24.8640724777864 in the first cell actually denote? If I can understand that better I might be able to come up with a different approach.

    This is a slow process, but we will get there.

  17. #17
    Registered User
    Join Date
    05-26-2009
    Location
    new york
    MS-Off Ver
    Excel 2007
    Posts
    76

    Re: How to Change values by increment in Data Table

    Hi Stephen,

    No offence taken. The value -24.8640724777864 in the first cell denotes that when cell C6 (column input) is 10 (cell AE16) and cell C8 (row input) is 10 (AF15), then the annualized return (which is the statistic being optimised in this case-see cell AE15) will be -24.86. This can be tested if you go into cell C6 and change the value to 10 and go to cell C8 and change the value to 10. By doing this, the statistics table updates and you can see that cell AF7 is now -24.86 and cell AF9 is -2.72 (sharpe ratio) which matches cell AF23 in the 2nd data table (this is the data table that is optimising for sharpe ratio). Thus, if you look at cell AG16, this is saying when cell C6 is 10 (AE16) and cell C8 is 60 (AG15), then the annualized return will be -4.1962. This can be verified by going into cell C8 and changing the value to 60. Then you will see that cell AF7 in the statistics box will have updated to -4.20.

    Therefore, the purpose of the data tables is to see how the individual statistics values would change if the two inputs were different values.

    I have searched online to try and find how it is exactly that excel is calculating these values with the data tables function (which I explained in my previous post) and I cannot find anything that says how one would recreate a data table. Would it be possible to use your code and modify it to work with the data tables that I already have? The only thing I would seek to change on the existing data tables is something that will capture the minimum, maximum and incremental values and adjust to them each time.

    Thanks for having the patience to work through this with me. I do appreciate it.

    Hope this helps.

    Maani

  18. #18
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: How to Change values by increment in Data Table

    Right, I think this works. It puts the tables on the same sheet, starting at I15. It's still a bit slow because the tables do have to be recalculated. Have a play to check it does what you want.
    Please Login or Register  to view this content.
    Attached Files Attached Files

  19. #19
    Registered User
    Join Date
    05-26-2009
    Location
    new york
    MS-Off Ver
    Excel 2007
    Posts
    76

    Re: How to Change values by increment in Data Table

    Thanks so much Stephen! That did it and now it works!

    Is there a way to have the data table update when any of the cells B22:B27 change? Currently, the data tables don't update unless we hit update. The other macros I have in the workbook were based on cell color, so that the graphs update when the colored cells change. However, since that has already been used, I wanted to get something similar to that, such as when the cells B22:B27 change and not have the button need to be pressed.

    Also, is there a way that the column and row values in the data tables are bolded automatically and the optimised statistic is highlighted?

    Thanks so much again.

    Maani
    Last edited by maani; 08-19-2009 at 11:45 AM.

  20. #20
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: How to Change values by increment in Data Table

    Maani - glad we got there. Have amended the block of code below, and picked out the optimised stat in green but you can change to suit:
    Please Login or Register  to view this content.
    Add this line to your existing worksheet change code to make it run automatically. A possible snag with this approach is that if you want to change more than one parameter it will get rather slow.
    Please Login or Register  to view this content.
    EDIT: the code may be speeded up by adding this line after the EnableEvents line
    Please Login or Register  to view this content.
    Remember to turn it back on.
    Last edited by StephenR; 08-19-2009 at 12:01 PM.

  21. #21
    Registered User
    Join Date
    05-26-2009
    Location
    new york
    MS-Off Ver
    Excel 2007
    Posts
    76

    Re: How to Change values by increment in Data Table

    EDIT: Thanks Stephen. This works perfectly. How does the code know when I am finished updating the optimisation table inputs? That is, what if I only update 3 inputs (out of the 6) or if I update all 6. How does it know when to start updating the table? Also, what would I need to change on the code in order to make the results in the data tables come out to 2 decimal places (it currently comes out to 9 decimal places)? As the spreadsheet is currently set up, the calculation method is set to automatic except for data tables. However, when saving the document before closing, it recalculates the data tables again. Is there a way to make it so that before saving the worksheet it doesn't recalculate the data tables (as this takes quite a bit of time).

    Finally, is there a way to have a contour chart (Insert»Other Charts»Surface»Contour) dump out into another worksheet automatically for each data table? I would do this the usual way of simply adding a chart after the data table is populated, but as the data table ranges will change everytime (and the row and column ranges), I wanted to see if there was a way to automate this through code.

    Also, what did you mean by remember to turn it back on. I am a bit confused on what I should turn back on.

    Thanks,

    Maani



    Thanks,

    Maani
    Last edited by maani; 08-20-2009 at 05:48 AM.

  22. #22
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: How to Change values by increment in Data Table

    How does the code know when I am finished updating the optimisation table inputs?
    You've hit on the snag I referred to in my previous post. The code will run as soon as you change any of those values. IMO you'd be better off with the button.

    Here is some revised code, which generates some charts, though don't know if they're right:
    Please Login or Register  to view this content.
    Not sure about the calculation thing - possibly the only way round that would be to set calculation to manual (as above), not generally considered advisable because you have to remember to manually calculate (but even then I think Excel automatically recalculates before a save).

  23. #23
    Registered User
    Join Date
    05-26-2009
    Location
    new york
    MS-Off Ver
    Excel 2007
    Posts
    76

    Re: How to Change values by increment in Data Table

    Hi Stephen,

    I see what you mean and agree with you on the use of the button. I think you are correct as well to use the automated version (as manual is not as reliable). Thanks so much for providing the new code, the charts are correct type. The only thing is that the charts are taking the row and column headers as well as the data from the data table. How would I do it so that it only takes the actual data in the data table and not the column headers? For example, in the 1st data table, it's taking AE21:AK26, whereas I would like it to take AF22:AK26.

    Also, If I wanted to put all the charts on one sheet and have a title for each (i.e. For data table 1="annualized return", for data table 2= "Sharpe Ratio", for data table 3="drawdown", for data table 4= "Annualized Risk/Reward) how would I do this? They are currently on 4 separate sheets and come up as "Chart1", "Chart2", "Chart3", "Chart4".

    Thanks for your patience with me

    Maani

  24. #24
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: How to Change values by increment in Data Table

    Maani - this should adjust the range for the charts:
    Please Login or Register  to view this content.
    For your question about chart placement and naming I suggest you start a new thread, probably in the Chart forum, as it is sort of separate and it's not really my area.
    Last edited by StephenR; 08-20-2009 at 12:21 PM.

  25. #25
    Registered User
    Join Date
    05-26-2009
    Location
    new york
    MS-Off Ver
    Excel 2007
    Posts
    76

    Re: How to Change values by increment in Data Table

    EDIT:

    Hi Stephen,

    Thanks again. I will put a post in the chart forum.

    The code you provided seems to be taking the data from each row. For example, AE22:AK22, instead of taking the entire data stream of AF22:AK26. I just don't want it to include the row and column headers as is currently being done. Would you know of a way to do this?

    Finally, would you be able to send me the same version of the code that you have provided (your most recent one) with the "press me" button being used instead of the automatic update? I'm just not sure how to change the code to reflect the use of the button.

    Maani
    Last edited by maani; 08-20-2009 at 11:26 AM.

  26. #26
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: How to Change values by increment in Data Table

    Oops, I posted the wrong code. I've amended the code in the my previous post. It puts all the charts on top of each other but they are all there.

    EDIT: can you check the graphs are correct as somehow I lost the code I wrote and which worked, and I'm not entirely sure if the current charts are showing the right data.
    Last edited by StephenR; 08-20-2009 at 12:22 PM.

  27. #27
    Registered User
    Join Date
    05-26-2009
    Location
    new york
    MS-Off Ver
    Excel 2007
    Posts
    76

    Re: How to Change values by increment in Data Table

    Hi Stephen,

    The latest code you sent is mixing up the data more than the previous one. The charts are now taking pieces of 2 data tables. It doesn't seem to be adjusting to the varying sizes of the data tables (as the row and column dimensions change). For example, in one example it took part of one data table, and another part of another data table.

    Could you confirm that the code you provided (see below) for the updating of the data tables is based on changing the cells in the optimisation table?

    The code you sent before (see below) this one was the one that had worked the best except that it was plotting the row and column headers as values in the chart (instead of using the row and column headers as axis values). Also, the top left value shouldn't be plotted or put on the axis at all.

    Interestingly, if I change the values in the optimisation table, it simply adds 4 more charts; it doesn't delete the previous 4. That is, I then have 8 charts. Is there a way to avoid this?

    Please Login or Register  to view this content.
    Sorry for the confusion. Is there a way that it could be adjusted to only plot the data in the data table and use the row and column headers as the axes values (and top-left cell not charted)?

    Thanks,

    Maani
    Last edited by maani; 08-21-2009 at 06:32 AM.

  28. #28
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: How to Change values by increment in Data Table

    Maani - as far as I can see the code I posted in post 24 works. If you look at the attachment the data ranges it uses for the four charts are

    J16:L18
    J21:L23
    J26:L28
    J31:J33

    which excludes headers.

    If you've adapted the code for your actual workbook, perhaps something went wrong in the process. Attach that file if you think it would help.
    Attached Files Attached Files

  29. #29
    Registered User
    Join Date
    05-26-2009
    Location
    new york
    MS-Off Ver
    Excel 2007
    Posts
    76

    Re: How to Change values by increment in Data Table

    EDIT:

    Hello Stephen,

    My apologies. I had made a mistake in adjusting the code to my worksheet. When I inputted your code and adjusted it correctly, I receive the same charts as you. I just have 2 final questions for you (I promise that will be it )

    1) The chart is taking the row and column headers as the x-axis and y-axis of the charts. However, on the y-axis it states 'Series 1', 'Series 2', 'Series 3', etc. and on the x-axis it states (1,2,3,4,5,etc). Would it be possible to have these replaced with the actual values in the x and y-axes? As it stands, it seems to be listing them by the number of values in the x-axis and y-axis instead of putting the exact values from the row and column headers as the axes values. Also, it seems to have the x and y-axes mixed up. The values on the x-axis are supposed to be the changing input from C8, and the values on the y-axis are supposed to be the changing inputs from C6. Currently, it seems to be doing the opposite.

    2) Once I hit the update button and the data tables populate and the charts load, the calculation method changes from 'automatic except for data tables' to 'manual.' Is there a way to have this remain as 'automatic except for data tables'?

    Thanks again,

    Maani
    Last edited by maani; 08-21-2009 at 11:01 AM.

  30. #30
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: How to Change values by increment in Data Table

    Maani - add the bold lines below. That seems to name the series - they y-axis? Am slightly flummoxed by x-axis, it doesn't seem to be labelled.
    Please Login or Register  to view this content.
    [/B]That calculation thing doesn't happen for me - could you have set something manually? O/w I'm not sure, perhaps somebody else will drop in.
    EDIT: added last line below - does this cover the other axis? Not sure if they're the right way round. As you may have picked up, this is flying by the seat of pants...
    Please Login or Register  to view this content.
    Last edited by StephenR; 08-21-2009 at 11:05 AM.

  31. #31
    Registered User
    Join Date
    05-26-2009
    Location
    new york
    MS-Off Ver
    Excel 2007
    Posts
    76

    Re: How to Change values by increment in Data Table

    Thanks Stephen. Where should I insert these codes within the larger code you sent me? Could you send the whole code with this included within it?

    Does the code adjust for the x and y-axes being mixed up? That is,will it switch the x and y-axes on the charts (not sure if you had gotten my last edit prior to sending your mail).

    Thank you so much for all of your patience and help!

    Maani
    Last edited by maani; 08-21-2009 at 11:19 AM.

  32. #32
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: How to Change values by increment in Data Table

    Here's the full code. You lost me a bit there so run it and report back on what needs changing.
    Please Login or Register  to view this content.

  33. #33
    Registered User
    Join Date
    05-26-2009
    Location
    new york
    MS-Off Ver
    Excel 2007
    Posts
    76

    Re: How to Change values by increment in Data Table

    Hi Stephen,

    When I put the new code in, it gave me the error 'Run-time error 1004: Invalid parameter.'

    When I hit debug, it highlighted the below portion of code
    Please Login or Register  to view this content.
    Maani

  34. #34
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: How to Change values by increment in Data Table

    Are you starting to wonder if we'll ever get there? I think I had the axes the wrong way round - try this:
    Please Login or Register  to view this content.

  35. #35
    Registered User
    Join Date
    05-26-2009
    Location
    new york
    MS-Off Ver
    Excel 2007
    Posts
    76

    Re: How to Change values by increment in Data Table

    Yes, I totally wonder if we'll ever get there. But I'm learning quite a bit, which I am very thankful for to you.

    The code you provided works and the axes are labeled with the row and column headers. The only issue is that the axes are mixed up. That is, the values on the x-axis should be on the y-axis and the values on the y-axis should be on the y-axis. I tried to change the row and column values in the code you provided but that didn't work.
    Last edited by maani; 08-24-2009 at 11:00 AM.

  36. #36
    Registered User
    Join Date
    05-26-2009
    Location
    new york
    MS-Off Ver
    Excel 2007
    Posts
    76

    Re: How to Change values by increment in Data Table

    Hi Stephen,

    As I was playing around with the spreadsheet this weekend, I kept noticing that whenever the data table values are recalculated in the worksheet, the calculation method changes from 'automatic except data tables' to 'automatic'. Could it possibly be due to

    Please Login or Register  to view this content.
    being part of the code? To see this error, try checking the calculation method in the worksheet and then change values in the optimisation table and hit the 'update' button. When you do this, see if you get the workbook recalculating. It would be fine, but the actual workbook I have is very large and this recalculation takes a very long time and slows down the workbook.

    Also, as the axes were mixed up, I tried switching the row and column in the code you provided but it gave me a invalid parameter issue.

    Could you please advise on how I would switch the axes based on your latest code?

    Thanks,

    Maani

  37. #37
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: How to Change values by increment in Data Table

    For calculation, try adding/amending:
    Please Login or Register  to view this content.
    For the axes, it's not clear to me how to achieve what you want - as I say perhaps post in the chart forum where no doubt there will be an expert or two. I can't really visualise how the chart would be different if you switched axes?

  38. #38
    Registered User
    Join Date
    05-26-2009
    Location
    new york
    MS-Off Ver
    Excel 2007
    Posts
    76

    Re: How to Change values by increment in Data Table

    Thanks for your reply Stephen. When amending the calculation code, sometimes it gives me a 'run time error-1004' and when I hit debug it highlights the following bit of code

    Please Login or Register  to view this content.
    However, other times it works fine. I think the issue is when I increase the range of values in the optimisation table. It is at those times that it gives me the run-time error.

    Is the revised code I have below correct?

    Please Login or Register  to view this content.
    I have also posted the charting questions for the axes in the charting forum. Thanks again,

    Maani
    Last edited by maani; 08-24-2009 at 02:24 PM.

  39. #39
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: How to Change values by increment in Data Table

    The code for the chart was generated by the macro recorder so I'm not completely au fait with it, and as you suggest larger tables do seem to throw up errors. In any case, Andy Pope seems to have sorted it out now so I think everything has been resolved?

  40. #40
    Registered User
    Join Date
    05-26-2009
    Location
    new york
    MS-Off Ver
    Excel 2007
    Posts
    76

    Re: How to Change values by increment in Data Table

    Yes, you are correct. Thanks so much with your help with creating a fix; I cannot begin to thank you for all you have done.

    Regards,

    Maani

  41. #41
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: How to Change values by increment in Data Table

    Glad that, with Andy's help, we got there.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

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