Skip to content

Commit 5034cb3

Browse files
committed
VBA-Expressions v3.0.0
1 parent 461f862 commit 5034cb3

File tree

7 files changed

+4434
-1064
lines changed

7 files changed

+4434
-1064
lines changed

README.md

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
[![GitHub](https://img.shields.io/github/license/ws-garcia/VBA-Expressions?style=plastic)](https://github.com/ws-garcia/VBA-Expressions/blob/master/LICENSE) [![GitHub release (latest by date)](https://img.shields.io/github/v/release/ws-garcia/VBA-Expressions?style=plastic)](https://github.com/ws-garcia/VBA-Expressions/releases/latest)
33

44
## Introductory words
5-
VBA Expressions is a powerful string expression evaluator for VBA, which puts more than 60 mathematical, financial, date-time, logic and text manipulation functions at the user's fingertips. The `VBAexpressions.cls` class mediates almost all VBA functions as well as custom functions exposed through it.
5+
VBA Expressions is a powerful string expression evaluator for VBA, which puts more than 90 mathematical, financial, date-time, logic and text manipulation functions at the user's fingertips. The `VBAexpressions.cls` class mediates almost all VBA functions as well as custom functions exposed through it.
66

77
Although the main development goal of the class was the integration with [CSV Interface](https://github.com/ws-garcia/VBA-CSV-interface), VBA Expressions has evolved to become a support tool for students and teachers of science, accounting and engineering; this due to the added capability to solve systems of equations and non-linear equations in one variable.
88

@@ -11,7 +11,7 @@ Although the main development goal of the class was the integration with [CSV In
1111
* __Basic math operators__: `+` `-` `*` `/` `\` `^` `!`
1212
* __Logical expressions__: `&` (AND), `|` (OR), `||` (XOR)
1313
* __Binary relations__: `<`, `<=`, `<>`, `>=`, `=`, `>`, `$` (LIKE)
14-
* __More than 60 built-in functions__: `Max`, `Sin`, `IRR`, `Switch`, `Iff`, `DateDiff`, `Solve`, `fZero`, `Format`...
14+
* __More than 90 built-in functions__: `Max`, `Sin`, `IRR`, `GAUSS`, `LSQRSOLVE`, `Switch`, `Iff`, `DateDiff`, `Solve`, `fZero`, `Format`...
1515
* __Very flexible and powerful__: variables, constants and user-defined functions (UDFs) support.
1616
* __Implied multiplication for variables, constants and functions__: `5avg(2;abs(-3-7tan(5));9)`, `5(x)` and `x(2)(3)` are valid expressions.
1717
* __Evaluation of arrays of expressions given as text strings, as in Java__: curly brackets must be used to define arrays`{{...};{...}}`
@@ -200,7 +200,32 @@ End Sub
200200
''' LUSOLVE(ARRAY(a;b;c);{{'x';'y';'z'}};{{2;3;4}};True) : x = -18; y = -9; z = 5
201201
''' MMULT(INVERSE(ARRAY(a;b;c));ARRAY(d)) : {{-18};{-9};{5}}
202202
''' MMULT(ARRAY(a;b;c);INVERSE(ARRAY(a;b;c))) : {{1;0;0};{0;1;0};{0;0;1}}
203-
'***********************************FINANTIAL FUNCTIONS***************************************************************
203+
'''
204+
''' A={{-2;40};{-1;50};{0;62};{1;58};{2;60}}
205+
''' FIT(A;1;4) : {{62 + 3.6667*x -9.6667*x^2 + 0.3333*x^3 + 1.6667*x^4};{1}} 4th degree polynomial fitting
206+
''' B={{0;0.1};{0.5;0.45};{1;2.15};{1.5;9.15};{2;40.35};{2.5;180.75}}
207+
''' FIT(B;2) : {{0.102*e^(2.9963*x)};{0.9998}} Exponential Fitting
208+
''' C={{1;0.01};{2;1};{3;1.15};{4;1.3};{5;1.52};{6;1.84};{7;2.01};{8;2.05};{9;2.3};{10;2.25}}
209+
''' FIT(C;5) : {{0.9521*ln(x)+0.1049};{0.9752}} Logarithmic fitting
210+
'''
211+
''' A={{2;4};{-5;1},{3;-8}};b={{10;-9.5;12}}
212+
''' MROUND(LSQRSOLVE(A;b);4) : {{2.6576};{-0.1196}} solve overdetermined system of equations using least squares and QRdec
213+
'***********************************STATISTICAL FUNCTIONS*******************************************************************************
214+
''' ROUND(NORM(0.05);8) = 0.96012239
215+
''' ROUND(CHISQ(4;15);8) = 0.99773734
216+
''' ROUND(GAUSS(0.05);8) = 0.01993881
217+
''' ROUND(ERF(0.05);8) = 0.05637198
218+
''' ROUND(STUDT(0.8;15);8) = 0.43619794
219+
''' ROUND(ANORM(0.75);8) = 0.31863936
220+
''' ROUND(AGAUSS(0.75);8) = 0.67448975
221+
''' ROUND(AERF(0.95);8) = 1.38590382
222+
''' ROUND(ACHISQ(0.75;15);8) = 11.03653766
223+
''' ROUND(FISHF(5.5;1.5;3);8) = 0.21407698
224+
''' ROUND(ASTUDT(0.05;15);8) = 2.13144955
225+
''' ROUND(AFISHF(0.05;1.5;3);8) = 18.55325631
226+
''' ROUND(iBETA(0.5;1;3);8) = 0.875
227+
''' ROUND(BETAINV(0.5;1;3);8) = 0.20629947
228+
'***********************************FINANTIAL FUNCTIONS*********************************************************************************
204229
''' FORMAT(SYD(10000;5000;5;2);'Currency') = '$1,333.33'
205230
''' FORMAT(SLN(10000;0;5);'Currency') = '$2,000.00'
206231
''' FORMAT(RATE(2*12; -250; 5000; 0; 1);'Percent') = '1.66%'
@@ -219,7 +244,7 @@ End Sub
219244
''' FORMAT(IPMT(0.0525/1; 4; 10*1; 6500);'Currency') = '($256.50)'
220245
''' FORMAT(FV(0.0525/1; 10*1; -100; -6500; 0);'Currency') = '$12,115.19'
221246
''' FORMAT(DDB(10000; 5000; 5; 2);'Currency') = '$1,000.00'
222-
'***********************************DATE AND TIME FUNCTIONS***************************************************************
247+
'***********************************DATE AND TIME FUNCTIONS*****************************************************************************
223248
''' YEAR(NOW()) = 2022
224249
''' WEEKDAYNAME(1;true;2) = 'lun.'
225250
''' WEEKDAY(NOW()) = 2
@@ -246,7 +271,7 @@ End Sub
246271
''' DATEADD(x;y;DATE()) = 10/3/2023 for x = 'm'; y = 5
247272
''' DATEADD(x;y;DATE()) = 20/10/2022 for x = 'd'; y = 10
248273
''' DATE() = '10/10/2022'
249-
'***********************************STRING FUNCTIONS***************************************************************
274+
'***********************************STRING FUNCTIONS******************************************************************************
250275
''' UCASE(x) = ' THIS STRING ' for x = ' This String '
251276
''' TRIM(x) = 'Capi tal' for x = ' Capi tal '
252277
''' RIGHT(2x+20-5+x;2) = '90' for x = 25
@@ -268,7 +293,7 @@ End Sub
268293
[![Rubberduck](https://user-images.githubusercontent.com/5751684/48656196-a507af80-e9ef-11e8-9c09-1ce3c619c019.png)](https://github.com/rubberduck-vba/Rubberduck/)
269294
## Licence
270295

271-
Copyright (C) 2022 [W. García](https://github.com/ws-garcia/).
296+
Copyright (C) 2022-2024 [W. García](https://github.com/ws-garcia/).
272297

273298
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 3 of the License, or (at your option) any later version.
274299

0 commit comments

Comments
 (0)