Financing
You can enter a source's amount as a formula that follows the budget, and you know why an Amount or Total stays empty.
In the **Amount** of a source, you can type a formula instead of a number. When the budget changes, KOSMA recalculates the amount, so a share such as 20 % of the budget stays up to date. An installment gets its amount in the installments dialog. The **Amount** of a subtotal shows the subtotal's name.
Click the source's **Amount** cell and type the formula, for example `250000 * 0.2` or `(NPC() * 0.2) - 15000`. `NPC()` is the budget without markups; `GT()` is the grand total including markups. A formula calculates with `+`, `-`, `*`, `/` and parentheses. There is no percent sign: for 20 %, write `* 0.2`. Inside a function, put a name in double or single quotes, for example `ACCOUNT("3.01")`. In the demo project, the source **Producer Equity** holds `GT() - 1297000`, which gives 110,622.15 EUR.
Write decimals with a point in every language, for example `0.2`, and without thousands separators. A comma only separates the arguments of a function. With `0,2`, the formula is invalid.
While you type, KOSMA shows a menu of the names a formula can use. The menu opens at the start of the formula and after each `+`, `-`, `*`, `/`, `(` and `,`. **Functions** lists the functions. **Variables** lists the variable groups **Phases** and **Subtotals**, plus your own. Type letters to narrow the list. When you pick a function that needs a name, KOSMA inserts the whole call with the quotes, for example `ACCOUNT("3.01")`. Anything you pick from the menu is spelled correctly.
Press `Tab` or click outside the cell. KOSMA saves the formula and shows the result in **Amount**. **Total** shows the result converted into the currency in its header, for example **Total (EUR)**.
KOSMA always reads a formula's result as an amount in the source's currency. `NPC`, `GT`, `ACCOUNT`, `SUM_COMPANY` and `SUM_TAG` return amounts in the budget's default currency. For example, the budget is in EUR, the source in CHF, and `GT()` returns 100,000. KOSMA takes this as 100,000 CHF and converts it to EUR for **Total**, so **Total** is wrong.
| Kind | Examples | Figures from | | ---------------------------------------- | ----------------------------------------------------------------------- | ------------------------------- | | The whole budget | `NPC()`, `GT()` | the linked budget | | One budget account | `ACCOUNT("3.01")` | the linked budget | | Budget money by company or tag | `SUM_COMPANY("…")`, `SUM_TAG("…")` | the linked budget | | Number of budget lines by company or tag | `COUNT_COMPANY("…")`, `COUNT_TAG("…")` | the linked budget | | Variables | **Phases**, **Subtotals**, your own variable groups | the linked budget | | This plan's sources by tag | `SUM_TAG_F("…")` | the sources of this plan | | This plan's sources by status | `FINANCING_CONFIRMED()`, `FINANCING_SUBMITTED()`, `FINANCING_PENDING()` | all but deactivated sources |
For the budget functions, see [reference the budget in a source amount](/kb/article/reference-the-budget-in-a-source-amount); for the functions that total this plan's sources, [aggregate financing sources in a formula](/kb/article/aggregate-financing-sources-in-a-formula); for variables, [use variables in a financing plan](/kb/article/use-variables-in-a-financing-plan).
If KOSMA cannot read the formula, or does not know a name that is outside quotes, the cell shows **Invalid** in a red frame, and the menu of names closes. Point at **Invalid** to see the unknown names:
Unknown part of expression: {names}
If you leave the cell while it shows **Invalid**, KOSMA does not save the formula and keeps the previous **Amount**.
Correct the formula before you leave the cell.
An empty **Amount** and **Total** means the source has no amount yet, or its formula gives no result. To see which, open the formula view with the toolbar button . The **Amount** column then shows each source's formula. KOSMA saves a typed number such as `350000` as a formula too. If the empty source shows a formula, that formula gives no result. If the cell stays empty, the source has no amount yet. For this view, see [switch between values and formulas](/kb/article/switch-between-financing-values-and-formulas).
An empty **Amount** adds nothing to the totals of the plan.
A formula gives no result in three cases:
- Someone deleted the account, company, tag or variable the formula names. - Someone copied the plan onto a budget that does not have a name the formula uses. See [copy a financing plan](/kb/article/copy-a-financing-plan). - Someone typed a name inside quotes wrongly, for example `SUM_TAG("Bayren")`. KOSMA does not check names inside quotes, so the cell does not show **Invalid**.
If you renumber an account or rename a company, tag or variable, KOSMA updates the formula, so it still gives a result.
Markdown