Automated Graphing Question

kpark91
StarLounger
Posts: 61
Joined: 29 Jul 2010, 14:52

Automated Graphing Question

Post by kpark91 »

Hello

I have a worksheet like the link below.

I have downloaded this off of internet but I don't remember where.

It automatically graphs one equation to my liking perfectly using no macros but rather names :grin:

I think I kind of understand how the name "x" works and all the others.
x =xStart1+xRange1/(xNumberOfPoints1-1)*(ROW(OFFSET(Sheet1!$A$1,0,0,xNumberOfPoints1,1))-1)

However, I'm having a problem understanding what the person did for "y"
y =EVALUATE(Sheet1!$B$1 & "+0*x")


I am trying to understand these so that I could plot 3 equations in one graph :scratch:
If I exactly know how x and y formulas work, I think I can do it :smile:

Could you please explain it to this noobie?

Thank you :)
You do not have the required permissions to view the files attached to this post.
I don't have one

User avatar
HansV
Administrator
Posts: 78620
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Automated Graphing Question

Post by HansV »

You probably downloaded ChartAnEquation.zip from Jan Karel Pieterse's JKP-ADS Download page. A detailed explanation is provided in his article Chart an Equation.

EVALUATE is an old function from the time that Excel didn't have VBA but a specialized macro language. It takes a string (text) expression and computes the outcome of this expression if were an Excel formula (by placing = before the expression). Such macro functions cannot be used directly in a cell formula, but you can use them in defined names, and you can use those in cell formulas.

Cell B1 on Sheet1 contains the text X^2. The expression EVALUATE(Sheet1!$B$1) computes the result of the formula =X^2.

The rather strange addition & "+0*x" is a trick. EVALUATE works with user-defined expressions but not with built-in functions such as SIN. By concatenating the expression in B1 with +0*x, you turn it into a user-defined expression regardless of what B1 contains.

In this particular example, B1 already contains a user-defined expression, so the addition isn't really required, but it won't do any harm either. If you enter SIN(X) in B1, however, it wouldn't work any more without the addition.
Best wishes,
Hans

kpark91
StarLounger
Posts: 61
Joined: 29 Jul 2010, 14:52

Re: Automated Graphing Question

Post by kpark91 »

Thank you very much HansV :)

Hopefully, I can graph 3 equations in the same graph now.

If not, could you give me a hand later (as in tomorrow)? :evilgrin:
I don't have one

User avatar
HansV
Administrator
Posts: 78620
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Automated Graphing Question

Post by HansV »

Just ask if necessary...
Best wishes,
Hans