May I please ask you how can I write a more complex formula in TextBlaze like the one in this video https://www.loom.com/share/4f51ab30e35a44e7b559dd064ca48a46.

Thanks!

Hi @Peter_Guirguis, welcome to the forum.

So, let's start step by step. First, here's the snippet as you created in the video:

Hi, here is the calculation for this week's giving:

\${formtext: name=TotalSales} total sales not including retail transfers
\${formtext: name=TotalSales} divided by 2 = \${=TotalSales/2} in profit
12% (includes tithe and offering) multiplied by \${=TotalSales/2} = \$XX
So our tithe plus offering will be \$XX

Hi, here is the calculation for this week's giving:

\${formtext: name=TotalSales} total sales not including retail transfers
\${formtext: name=TotalSales} divided by 2 = \${=TotalSales/2} in profit
12% (includes tithe and offering) multiplied by \${=TotalSales/2} = \${=(TotalSales/2)*0.12}
So our tithe plus offering will be \$XX

However, I've got some additional suggestions for improving your snippet. Here's how I would do it:

{note}
{formtext: name=TotalSales; default=100}
{profit=TotalSales/2}
{percentage=profit*0.12}

=== The above won't show up when the snippet is inserted ===
{endnote: trim=right}
Hi, here is the calculation for this week's giving:

\${=TotalSales} total sales not including retail transfers
\${=TotalSales} divided by 2 = \${=profit} in profit
12% (includes tithe and offering) multiplied by \${=profit} = \${=percentage}
So our tithe plus offering will be \${=percentage}

Let me walk you through it step by step.

At the top, I've got a note block (the content between `{note}` and `{endnote}`). Anything I put in that note block will show up in the popup window when I run the snippet, but will not be inserted.

Inside the note block, I'm defining all of my variables and working out all of my formulas.

The `trim=right` in the `endnote` command is there to remove any white space after the note block. This keeps the snippet output neat.

From there onwards, it's just a question of recalling the variables by putting the variable name inside curly brackets with an equals sign before it (as you can see in the example). You'll notice that once I've created a `formtext` command and given it a name, I don't need to re-use the command — I just need to recall the variable.

Hope this helps