You are here: Home / Extras / Calculating with formulas / Use for contacts and property / FAQ - Troubleshooting Formulas and Macros

Calculating with formulas

FAQ – Troubleshooting Formulas and Macros

Learn how to quickly identify and independently correct common errors in calculation formulas and macros so that automatic calculations in your contact and property records, as well as in your templates, always work smoothly.

Added Value for Your Day-to-Day Work

Formulas and macros save valuable time in a real estate agent’s day-to-day work—for example, when automatically calculating the rent including utilities, determining the sales tax on the brokerage commission, or generating dynamic text in property listings and emails. However, if a formula does not produce the desired result but remains as illegible code, this hinders work processes.

This FAQ provides you with a practical reference that will help you fix syntax and notation errors in just a few minutes, even without any programming knowledge.

Requirements

  • User rights: To edit calculation formulas in fields (field formulas), you need administrator rights or access to the administration area.
  • To customize macros in templates, you need write permissions for the Template Manager (Edit → Templates / Files).

The 3 Golden Rules

Tip: If a formula doesn’t work, 95% of the time it’s because of a deviation from these three basic rules.

  1. Field names ALWAYS go in square brackets:
    Always use [kaufpreis], never kaufpreis or _kaufpreis.
  2. Always separate decimal numbers with a period:
    The system only recognizes the period as a decimal separator for mathematical operations: 3.5 instead of 3,5.
  3. Formulas begin with an equals sign:
    In calculation fields, every mathematical expression must begin with = (e.g., =[kaltmiete]+[nebenkosten]).

Common Problems & Solutions

Problem 1: Formula remains as text (e.g., _calculate(…))

  • Symptom:
    In the generated email, document, or field value, you see the formula in plain text, for example: _calculate(FIXED([kaufpreis], 2)) or _if([status] == “active”; “yes”; “no”).
  • Important:
    A formula that has stopped working never means that the macro is missing or that the system is defective. There is always a formula or syntax error within the macro.

Possible Causes & Immediate Help:

  • Missing square brackets: Was _calculate(FIXED(kaufpreis, 2)) written? Enclose the field name in square brackets: [kaufpreis].
  • Invalid field identifier: The field does not exist or contains a typo. Check the exact system name under Settings → Administration → Input Fields.
  • Comma instead of period: 19,0 causes the calculation to be terminated. Use 19.0.

Problem 2: Formula doesn’t calculate correctly even though the numbers are correct

  • Symptom:
    The field remains blank or returns 0 or #VALUE!.
  • Cause:
    • For custom fields, the visible label text was used instead of the internal field name.
    • The formula does not begin with an =.
  • Solution:
    Use the technical field identifier. For additional fields created administratively, this would be, for example, [ind_2728_Feld_ObjIndividualCategoryFields83].

Problem 3: Combination of formula and macro fails

  • Symptom:
    A formula such as _calculate(FIXED([kaufpreis]*(100+_Mehrwertsteuer)/100; 2)) terminates prematurely or returns no result.
  • Why this happens:
    Macros such as _Mehrwertsteuer often output preformatted text (e.g., “19%” or “19,00” with a comma). A mathematical system cannot perform calculations using percentage signs or commas.
  • Recommended Solutions:
    • Solution A (Recommended): Use only numeric fields for calculations:
      =FIXED([kaufpreis]*(100+[mehrwertsteuer_prozent])/100; 2)
    • Solution B: First perform the calculation and then apply the formatting separately:
      _calculate([kaufpreis]*(100+[mehrwertsteuer_prozent])/100)

Right vs. Wrong: Common Syntax Errors

 ❌ Incorrect spelling

 ✅ Correct spelling

 Why?

_calculate(_kaufpreis * 1.19)

_calculate([kaufpreis] * 1.19)

Field names in formulas must not have an underscore prefix; instead, they must use square brackets.

[kaltmiete] + [nebenkosten]

=[kaltmiete] + [nebenkosten]

An arithmetic operation must always begin with =.

=[wohnflaeche] * 12.50

=[wohnflaeche] * 12.50

Commas are syntactic separators. Decimal places require a period.

[vorname] + [nachname]

=[vorname] & ” ” & [nachname]

The plus sign adds numbers. Text is linked using the ampersand (&).

Step by step: Systematically Narrow Down Formula Errors

If a complex formula does not resolve, follow these steps:

    1. Check field name:
      Go to Settings → Administration → Input Fields. Select the relevant module (Properties or Contacts) and verify the exact technical field name in Field Management.
    2. Simplify the formula:
      Copy the formula into a text editor and break it down into its basic components:
      • Step 1: Display only the single field: =[kaufpreis]
      • Step 2: Test basic arithmetic skills: =[kaufpreis] * 1.19
      • Step 3: Only then should you add functions such as ROUND() or FIXED().
    3. Check special characters:
      Make sure there are no hidden spaces before the = sign and that quotation marks are set to straight quotation marks ("...") when comparing text.

Overview of Available Formula Functions

In onOffice enterprise, the following standard features among others are available to you:

  • Numbers & Rounding:
    ROUND(Wert; Stellen), ROUNDUP(Wert; Stellen), ROUNDDOWN(Wert; Stellen), SUM(…), AVERAGE(…), MIN(…), MAX(…)
  • Logic & Conditions:
    IF(condition; then-value; else-value), AND(…), OR(…), NOT(…)
  • Text Manipulation:
    LENGTH(Text), LEFT(Text; Anzahl), RIGHT(Text; Anzahl), TRIM(Text), & (Verkettung)
  • Date & Time:
    TODAY(), NOW(), DATEADD(…), DATEDIF(…)

Do you need further assistance?

If a formula fails to process despite having correct syntax, please contact onOffice Supportwith the exact formula text and details of the affected record.