Zuletzt aktualisiert:

Add functions to calculation formulas

Learn how to add functions to calculation formulas via the web app and the mobile app.

What does it mean to add functions to formulas?

Manually extracting data from inspections and transferring it to spreadsheet programs for calculations can be time-consuming and inefficient. With functions in your calculation formulas, you can instantly process and analyze data within SafetyCulture, eliminating the need for third-party tools. This ensures you have real-time insights at your fingertips, enabling faster, data-driven decisions the moment information is captured.

Users must have version 25.12 or later of the SafetyCulture mobile app to view functions added to calculation questions in inspections.

Add functions to a calculation formula

  1. Log in to the web app.

  2. Select Templates iconVorlagen from the menu on the left-hand side.

  3. Click the template and select Vorlage bearbeiten in the side panel.

  4. Add a new number response question or select an existing one.

  5. Create or edit a calculation formula.

  6. In the side panel, type $ and select the function you want to use. Then, type $ followed by a question's label to use it as an argument. Please note that functions are case-sensitive.

    • You can also select the relevant function and question from the "Functions" and "Questions" dropdowns.

  7. Click Speichern und anwenden.

  8. Click Veröffentlichen on the upper-right of the page to publish the template. If you're not ready to publish the template, you can go back to the template list and publish the changes when you're ready.

  1. Open the mobile app.

  2. Tap Inspections icon mobileInspektionen at the bottom of your screen.

  3. Select Vorlagen tab at the top of your screen.

  4. Tap the template and select Pencil iconVorlage bearbeiten from the pop-up options.

  5. Add a new number response question or select an existing one.

  6. Under the question, tap More vertical icon on the right-hand side of "Number" and tap Nummer next to "Format".

  7. On this screen, select Berechnung.

  8. Type $ and select the function you want to use. Then, type $ followed by a question's label to use it as an argument. Please note that functions are case-sensitive.

    • You can also select the relevant function and question from the "Functions" and "Questions" dropdowns.

  9. Tap Speichern und anwenden.

  10. Tap Veröffentlichen on the upper-right of the screen to publish the template. If you're not ready to publish the template, you can go back to the template list and publish the changes when you're ready.

Formeln, die Zahlenfragen mit Maßeinheiten verwenden, werden nicht automatisch konvertiert.

Wenn Sie z. B. die Geschwindigkeit in Kilometern pro Stunde berechnen und sich auf eine Zahlenfrage beziehen, in der Meter als Einheit verwendet werden, werden Meter nicht in Kilometer umgerechnet. Sie müssen dann die Einheit in der Zahlenfrage oder die Zahlenfrage selbst ändern.

Available functions

This table outlines all the available functions for calculation formulas. In a function, "Value" can either be a referenced question or an integer.

Function

Format

Description

SQRT (Square root)

SQRT(Value)

Returns the square root of the value. For example, SQRT(9) = 3.

ABS (Absolute value)

ABS(Value)

Returns the absolute (positive) value of the input. For example, ABS(-5) = 5.

SIN (Sine)

SIN(Value)

Returns the sine of the given radian. For example, SIN(3.14 / 2) = 1.

COS (Cosine)

COS(Value)

Returns the cosine of the given radian. For example, COS(0) = 1.

POWER

POWER(Value 1, Value 2)

Raises the first value to the power of the second. For example, POWER (2,3) = 8.

LOG

LOG(Value 1, Value 2)

Returns the logarithm of the first value to the base of the second. For example, LOG(8,2) = 3.

SUM

SUM(Value 1, Value 2)

Calculates the sum of all values. For example, SUM(1,5,9) = 15.

AVERAGE

AVERAGE(Value 1, Value 2)

Computes the average (mean) of all values. For example, AVERAGE(4,8,12) = 8.

MEDIAN

MEDIAN(Value 1, Value 2)

Returns the median value from the input numbers. For example, MEDIAN(3,1,4,2,5) = 3.

MODE

MODE(Value 1, Value 2)

Returns the most frequently occurring value from the given values. For example, MODE(3,5,3,7,5,5) = 5.

STDEV (Standard deviation)

STDEV(Value 1, Value 2)

Calculates the standard deviation of the given values. For example, STDEV(4,8,6,5,9) = 1.87.

AVEDEV (Average deviation)

AVEDEV(Value 1, Value 2)

Calculates the average deviation of the given values. For example, AVEDEV(4,8,6,5,9) = 1.68.

DEFAULT_VALUE

DEFAULT_VALUE(Question, Default value)

The DEFAULT_VALUE function will need to reference a question and an integer in the respective order.

Returns the default value if a referenced question is unanswered. For example, DEFAULT_VALUE(Question, 15).

If the question is answered, the function is equal to the number entered.

If unanswered, the function is equal to 15.

Nicht VBA-Makro-aktiviert (Excel)

An argument is a value or input that a function uses to perform a calculation. In calculation formulas, arguments can be numbers or questions, enclosed in parentheses. Some functions allow multiple arguments to refine calculations further.

For example, in the formula AVERAGE(Question 1, Question 2, Question 3), each question referenced is considered as 3 separate arguments.

Obwohl Fragen mit Antworttyp "Berechnung" in wiederholten Abschnitten unterstützt werden, gibt es Szenarien, in denen es nicht möglich ist, eine Formel und eine Referenznummer oder eine Frage mit Antworttyp "Berechnung" in wiederholten Abschnitten zu erstellen.

Szenario 1: Eine Formel innerhalb eines wiederholten Abschnitts kann sich nicht auf eine Zahl oder eine Frage mit Antworttyp "Berechnung" beziehen, wenn diese Teil eines verschachtelten wiederholten Abschnitts ist.

Im folgenden Beispiel kann die Frage mit Antworttyp "Berechnung" Gesamt - Elternteil nicht auf die Antwortfragen in den wiederholten Abschnitten (Kind) verweisen, weil sie im wiederholten Abschnitt (Elternteil) verschachtelt ist.

Edge case scenario example of referencing a number or a calculation response question in repeat sections via the web app.

Szenario 2: Eine Formel innerhalb eines wiederholten Abschnitts kann sich nicht auf eine Zahl oder eine Frage mit Antworttyp "Berechnung" aus einem separaten wiederholten Abschnitt beziehen.

Im folgenden Beispiel kann die Frage mit Antworttyp "Berechnung" Gesamt - 2 nicht auf die Antwortfragen in den wiederholten Abschnitten (1) verweisen, weil die Fragen aus separaten wiederholten Abschnitten stammen.

Edge case scenario example of referencing a number or a calculation response question in repeat sections via the web app.

If your inspection has a calculation formula with functions, you may get an error message on mobile app versions below 25.12. While the data entered will be calculated and can still be viewed on the web app, it's best to keep your mobile app up to date to ensure you can view functions in inspections.

Brauchen Sie noch weitere Hilfe?
In diesem Artikel