# Formula troubles Part 2

Hello again Panorama friends,
You have been very helpful with by first request. It worked just fine. My remaining problem is getting two different results to give a total amount.
The first formula gives the correct total amount of 873,600 by using the multiplier of 10400 : {PATTERN(10400*(VAL(«TK»)+VAL(«K»)+VAL(«1»)+VAL(«2»)+VAL(«3»)+VAL(«4»)+VAL(«5»)),"#,.##")}
The second formula gives the correct total amount of 640,360 by using the multiplier of 11435: {PATTERN(11435*(VAL(«6»)+VAL(«7»)+VAL(«8»)),"#,.##")}

I want to display the total of the first formula plus the amount of the second formula such as \$1,513,960

You need to realize that the first argument of the pattern( function as a number. In the first formula it is 10400*(VAL(«TK»)+VAL(«K»)+VAL(«1»)+VAL(«2»)+VAL(«3»)+VAL(«4»)+VAL(«5»)), in the second, it is 11435*(VAL(«6»)+VAL(«7»)+VAL(«8»)). Simply add those together, and plug the sum into the first argument of the pattern( function.

As Bruce says, you need to combine both formulas into a single `pattern(` function which can be a little hairy trying to keep track of all the parentheses involved. I think this might be what you need:

`{Pattern((10400*(VAL(«TK»)+VAL(«K»)+VAL(«1»)+VAL(«2»)+VAL(«3»)+VAL(«4»)+VAL(«5»)))+(11435*(VAL(«6»)+VAL(«7»)+VAL(«8»))),"#,.##")}`

Thanks Gary. That worked just the way I wanted. I was try to add the two figures and it was a disaster. You are exactly correct trying to keep track of the right amount of parentheses. As always thanks for your help.

The parentheses around the two summands are redundant.
a*(b+c+d)+e*(f+g+h) works just fine. Multiplication comes first, and then addition. This is why you need the parentheses where they are: `a*b+c+d` only multiplies a times b, and then adds c and d, so you need the parentheses to add b+c+d first. e is multiplied time f+g+h because of the parentheses, but since multiplication comes before the addition, you do not need parentheses around the product. But it does not hurt to have them. a*(b+c+d)+e*(f+g+h)=(a*(b+c+d))+(e*(f+g+h))

``````3*4+5
You can also embed code or formulas by enclosing it in back-ticks, for example `3*4+5` or `x*y^2`. Without the backticks, this would display as: 34+5 or xy^2, not good, obviously.