Skip to content

Google Apps Script Custom Formula that evaluates a mathematical expression with a variable substituted by a given value.

Notifications You must be signed in to change notification settings

antonioken22/evaluate-function-gs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 

Repository files navigation

EVALUATEFUNCTION(expression, variable, value)

Google Apps Script Custom Formula that evaluates a mathematical expression with a variable substituted by a given value.

Since Google Sheets doesn't have a built in formula for this so, I made one myself.

YouTube Shorts Demo

https://youtube.com/shorts/xIv6wPgIyZo?si=cgYEywZShYYc9FtW

EVALUATEFUNCTION() Demo

Syntax Errors return the entire string to be evaluated instead of the final result (Shown on the right).
EVALUATEFUNCTION_demo[0] EVALUATEFUNCTION_demo[1]
EVALUATEFUNCTION("x^(2) + (8/3)*x - 20","x", 3)
EVALUATEFUNCTION_demo[2] EVALUATEFUNCTION_demo[3]
EVALUATEFUNCTION("cos(x) - x","x", =PI())
Note: Trigonometric Functions evaluates to DEGREES by default, you can change it to RADIANS in the `Code.gs` Editor
EVALUATEFUNCTION_demo[4] EVALUATEFUNCTION_demo[5]
EVALUATEFUNCTION("log(x) - 1/x","x", 3)
EVALUATEFUNCTION_demo[6] EVALUATEFUNCTION_demo[7]
EVALUATEFUNCTION("log10(x) - 1/x","x", 3)
EVALUATEFUNCTION_demo[8] EVALUATEFUNCTION_demo[9]

How to use?

  • Just copy the entire Javascript code from EVALUATEFUNCTION.js and paste it into your own Google App Script Code.gs.
  • Save

References

Bugs?

  • create an issue

Thank you.

About

Google Apps Script Custom Formula that evaluates a mathematical expression with a variable substituted by a given value.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published