how do i do an inline function like in matlab

J

jonathon wycherley

in excel i want to be able to type in a equation ie y=2x then in another cell
refer to and use this as a formula to do a calculation. but when you change
the equation the formula in the claculation changes to the new equation like
in matlab the inline function
 
A

Art

You might consider named cells.

Example:

put 2 in A1. Then name A1 as x. (insert, name, define -- or just type x in
the "name box" when cell A1 is selected.
Next put =2*x in cell A2. Name it y.
Now you can write another equation referencing x or y anywhere you like.

Be careful of something. You can't give your cells valid cell references as
names. For example, you can't name a cell A5 or BA12.

Art
 
G

Guest

Hi

I am not familiar with matlab at all, and I am fairly new
to Excel - but I think to do what you want to do would
require you to inplement some quite funky code. Also I am
assuming that y would be the cell showing the result, and
x is an input variable of some kind. I think you would
end up having to create a function "ParseAndCalc
(InputFormula, variableX, VariableY, Variable.....)

In your function you would then need to parse out the
operators and wite equivalent functions for +-/^ etc and
then figure out which variables to pass to them, figure ot
what is a literal value and pass this around - all a lot
of fun to do! THough givcen my relative newbie-ness there
may be another far simpler way someone else can suggest.
 
F

Frank Kabel

Hi
Excel is not designed for such things. This would require some VBA coding,
etc.
 
H

hrlngrv - ExcelForums.com

Frank Kabel wrote...
Excel is not designed for such things. This would require some VBA
coding, etc.
...

Inline functions would require some rather sophisticated VBA coding to
ensure that parsing worked correctly, and there are very few
respondents in these newsgroups who have any experience writing
lexical analyzers or parsers who could provide support in
development.

Better to be more forthright: Excel can't do this without a lot of
agonizing programming, and even then the results will be less than
satisfactory. If the OP wants math software functionality, the OP
should use math software, not Excel. Perhaps siag (a linux/unix
spreadsheet implemented in Scheme, this the name - Scheme In A Grid)
would provide this, but it's the only one I can think of that might
be able to.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top