You are on page 1of 14

Eval Function

=eval(Function,Parameter range,Value Range, Optional ReturnType, Optional CommaDec)

Evaluate a function, replacing the parameters listed in the


Parameter range with the corresponding values in the Value Range

Function is a single cell or text string containing the function to be evaluated


Parameter range and Value range are single column or single row ranges containing the same number of
cells

If ReturnType = 0 Eval returns the function string after substitution of values


If ReturnType = any other value, or is ommitted, Eval returns the value of the function after substitution of values

If CommaDec = True then before evaluation all commas are converted to decimal points and all semi-colons are converted to
If CommaDec = False or is omitted then commas and semi-colons are not converted

SubstituteA Function - see also Substitute sheet


=SubstituteA(Function,Parameter range,Value Range)
SubstituteA returns the same string as Eval with a ReturnType of 0.
The same results are also given by repeated application of the Excel built-in Substitute() function.

EvalText Function
=EvalText(Function)
EvalText evalutes a text function consisting of numerical values, for example the output of the SubstituteA function.
The text may also be evaluated using a defined name (see Eqn1_1 in Name Manager and the example below).

Examples
Function Result Display parameter values using Eval() UDF Display parameter valu
F*L^3/(3*E*I) #VALUE! #VALUE! =F*L^3/(3*E*I)
Evaluate usung EvalText() UDF =0.1*L^3/(3*E*I)
F 0.1 #VALUE! =0.1*10^3/(3*E*I)
L 10 =0.1*10^3/(3*200000*
E 200000 =0.1*10^3/(3*200000*
I 0.083333 Evaluate using defined
#NAME?
Function Result Display parameter values using SubstituteA() UDF
=Beta*E*K*sin(I) #VALUE! #VALUE!
Evaluate usung EvalText() UDF
t 0.1 #VALUE!
b_0 3.9
b_1 1.9
h 3.9
E 3.00E+07
PR 0.285
E 3.00E+07
K =+t^3/3*(2*b_0+4*b_1) #VALUE!
Cw +t*b_0^2/24*(8*b_1^3+6*h^2*b_1+h^2*b_0+12*b_1^2*h) #VALUE!
G +E/(2*(1+PR)) #VALUE!
I 0.78539816
Beta =+(K*G/(Cw*E))^0.5 #VALUE!

Evala Function
=evala(Function,Parameter range,Value Range, Optional xRange, Optional CommaDec)

Evaluate a function, replacing the parameters listed in the


Parameter range with the corresponding values in the Value Range
If xRange is present the function will return an array of values with
the parameter given in the first cell of xRange replaced by each value in the range

xRange is a single column or row range with the parameter to be substituted


in the first cell, followed by any number of values.

If xRange is present EvalA returns a single column array, and should be entered as
an array function (press ctrl-shift-enter)

If CommaDec = True then before evaluation all commas are converted to decimal points and all semi-colons are converted to
If CommaDec = False or is omitted then commas and semi-colons are not converted

Function
=Y_0 +(R^2-(x-X_0)^2)^.5
R 3
X_0 0
Y_0 1

x Results
0 #VALUE!
0.1 #VALUE!
0.2 #VALUE!
0.3 #VALUE!
0.4 #VALUE!
0.5 #VALUE!
0.6 #VALUE!
0.7 #VALUE!
0.8 #VALUE!
0.9 #VALUE!
1 #VALUE!
1.1 #VALUE!
1.2 #VALUE!
1.3 #VALUE!
1.4 #VALUE!
1.5 #VALUE!
1.6 #VALUE!
1.7 #VALUE!
1.8 #VALUE!
1.9 #VALUE!
2 #VALUE!
2.1 #VALUE!
2.2 #VALUE!
2.3 #VALUE!
2.4 #VALUE!
2.5 #VALUE!
2.6 #VALUE!
2.7 #VALUE!
2.8 #VALUE!
2.9 #VALUE!
3 #VALUE!

Using Eval with other UDFs

Tfunc is a UDF evaluating: A * Sin(x) ^ C + B * Cos(x) ^ C

=B*tfunc(A,B,C,x) #VALUE!

x A B C
0.4 2 2 3
on of values

colons are converted to commas

uteA function.

Display parameter values using Substitute() Function


=F*L^3/(3*E*I)
=0.1*L^3/(3*E*I)
=0.1*10^3/(3*E*I)
=0.1*10^3/(3*200000*I)
=0.1*10^3/(3*200000*0.0833333333333333)
Evaluate using defined name
Eqn1_1 is defined as: =EVALUATE(Eval!$J$30)
colons are converted to commas
Evalint Function
=evalint(Function,Parameter range,Value Range, Integration parameters, Optional Integration type)

EvalInt evaluates the integral of a function over a specified range, with a specified
number of increments. Either Simpson's Rule (default) or the Trapezoidal Rule may be
used. If Simpson's Rule is specified with an odd number of increments the increment
number is increased by 1.

Function = function to be integrated


Parameter range = range with constant symbols
Value range = range with constant values
Integration parameters = range with:
variable symbol, integration range lower limit,integration range upper limit, number of steps
Integration type = 1 for Simpson's Rule, 2 for Trapezoid Rule

Parabola
Function Result
= exp(X) * sin( B*X) #VALUE!

B 2

X 5.3 10.7 10000

Semi-Circle
Function Result
=(R^2-x^2)^.5 #VALUE!
R 1
x 0 0.707106781 100

Trignometric function
Function Result
=A*sin(x)^C+B*cos(x)^C #VALUE!

A 1
B 2
C 3
x 0 1.570796327 100
Evalintt Function
=evalint(Function,Parameter range,Value Range, Integration parameters, Optional Integration type)

EvalintT evaluates the integral of a function over a specified range, to a specified


tolerance by successive doubling of the number of integration steps.
Either Simpson's Rule (default) or the Trapezoidal Rule may be used

Function = function to be integrated


Parameter range = range with constant symbols
Value range = range with constant values
Integration parameters = range with:
variable symbol, integration range lower limit,integration range upper limit, tolerance, maximum number of loops
Integration type = 1 for Simpson's Rule, 2 for Trapezoid Rule

Estimated Number of
Simpson's Rule Result error loops Time
= exp(X) * sin( A*X) #VALUE! #VALUE! #VALUE! #VALUE!
A 2
Integration Limits Tolerance Max Loops
X 5.3 10.7 5.00E-09 10

Estimated Number of
Trapezoidal Rule Result error loops Time
= exp(X) * sin( A*X) #VALUE! #VALUE! #VALUE! #VALUE!
A 2
Integration Limits Tolerance Max Loops
X 5.3 10.7 5.00E-09 10

Trignometric function
Estimated Number of
Function Result error loops Time
=A*sin(x)^C+B*cos(x)^C #VALUE! #VALUE! #VALUE! #VALUE!

A 1
B 2
C 3
Integration Limits Tolerance Max Loops
x 0 1.570796327 1.00E-13 11

Evaluate Pi
Estimated Number of
Function Result error loops Time
=A*(1-X^2)^.5 #VALUE! #VALUE! #VALUE! #VALUE!
A 1
Integration Limits Tolerance Max Loops
X 0 0.5 1E-15 9
maximum number of loops

Error
#VALUE!

Estimated Pi Error
#VALUE! #VALUE!
SubstituteA Function
=Substitutea(Function,Parameter range,Value Range)

Substitute values for parameters in a text function.

Function is a single cell or text string containing the function to be evaluated


Parameter range and Value range are single column or single row ranges containing the same number of
cells

Function Result
F*L^3/(3*E*I) #VALUE!

F 2.5
L 10
E 200000
I 0.083333

SubstituteA Function #VALUE!


Eval function with optional argument = 0 #VALUE!

Repeated use of built-in SUBSTITUTE() function =F*L^3/(3*E*I)


=2.5*L^3/(3*E*I)
=2.5*10^3/(3*E*I)
=2.5*10^3/(3*200000*I)
=2.5*10^3/(3*200000*0.0833333333333333)
Evaluation using EvalText() function #VALUE!
Evaluation using a defined name #NAME? Eqn1_1 is defined as: =EVALUATE(Substitute!$F$27)
Substitute!$F$27)
Disclaimer
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,


but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

dougjenkins@interactiveds.com.au
www.newtonexcelbach.wordpress.com
www.interactiveds.com.au

ã Copyright 2012 Interactive Design Services Pty Ltd. all rights reserved

Revision History

Current Version 1.80 12-Jun-12

Rev Date By Description

1.00 22-Apr-08 DAJ First release


1.10 5-Jul-08 DAJ EvalInt function added
1.20 10-Mar-09 DAJ EvalIntT function added
1.30 10-Apr-09 DAJ GaussInt and GetGaussA functions added
1.40 28-Jun-10 DAJ Application of default values fixed in GaussInt
1.50-1.60 Versions including Alglib and Tanh-Sinh functions; Saved as Eval-Integration
1.70 9-Dec-10 DAJ Gaussint, Alglib and Tanh-Sinh functions saved as separate file, Eval function modified to o
1.80 12-Jun-12 DAJ Eval and EvalA modified to allow use of comma decimal separator.
al function modified to optionally return function with values substituted for variables, Substitutea function and evaltext function added
evaltext function added

You might also like