ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   X, Y Graph (https://www.excelbanter.com/excel-programming/276930-x-y-graph.html)

Noone

X, Y Graph
 
Hi,
Is there a way to automatically plot an x,y graph in which
x will be varied from n to m in k steps?

The y value is calculated in the same spreadsheet using multiple formulas
throughout the spreadsheet (So it is not a single formula in a single cell).

Michael



Bernie Deitrick[_2_]

X, Y Graph
 
Michael,

An easy way is to use a macro to vary X and record both X and Y in a table. It is easier in Excel 2000 or higher, since you can
force a calculation a little better.

For example, if you enter X into Cell A1, and all the intermediate formulas result in the final value in cell A10, with nothing in
either columns B or C (which is where I will put the resulting table) the sub below will generate the table, which you can then use
to create your graph. You can make the graph generation into a macro as well.

HTH,
Bernie
Excel MVP

Sub TryNow()
Dim X As Double
Dim N As Double
Dim M As Double
Dim K As Integer

N = 1
M = 10
'Enter the number of values you want, rather than steps
K = 6

For X = N To M Step (M - N) / (K - 1)
Range("A1").Value = X
Application.CalculateFull
Range("B65536").End(xlUp)(2).Value = X
Range("C65536").End(xlUp)(2).Value = Range("A10").Value
Next

End Sub




"Noone" wrote in message ...
Hi,
Is there a way to automatically plot an x,y graph in which
x will be varied from n to m in k steps?

The y value is calculated in the same spreadsheet using multiple formulas
throughout the spreadsheet (So it is not a single formula in a single cell).

Michael






All times are GMT +1. The time now is 10:37 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com