Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Breaking a formula to create expression

I have a problem not solved and esoerio as someone can provide some solution. I have a table that contains records with mathematical formulas like this:

Field 1     Field 2

REG1      A

REG2      B

REG3     A + B

REG4      C

REG5      A + B + C

And another trabla with:

Field 2     Amount

A                100

B                20

C                120

A                50

A                250

B                300

As I can write the expression to get this result, considering that the basic operations arepossible (+, -, *, /) and can be combined into one operation.

Field 1     Total

REG1      400

REG2      320

REG3      720

REG4      120

REG5      840

5 Replies
luciancotea
Specialist
Specialist

Use EVALUATE() function

Not applicable
Author

This option is valid because I need to do the calculation in the expression and not in the scrip. Anyway is there any equivalent function EVALUATE for incorporation into an expression or is there another solution

.

luciancotea
Specialist
Specialist

You can use $() function to evaluate an expression, but you must give it an expression to evaluate, not a table of expressions.

You need in fact first to do an aggregation of Amount column by Field 2 of the second table (which btw should be not named like that because it will do a join with Field 2 from the first table), then apply the formula.

You have to rethink your approach.

Not applicable
Author

I cannot find the way to go. Now I'm looking to see if breaking the formula with something but do not see it either.

Not applicable
Author

Can you make a call to a macro to do the calculation from an expression of a pivot table? This being so, how would you do?