# Calculation Component

Adding calculations to your form is a great way to automate processes, such as
estimating costs, calculating scores, or summing up user inputs. This guide will
walk you through how to set up calculations in WhatsForm.



In this example, we’ll demonstrate how to create a simple form that calculates
the total cost of selected items (eggs, bread, milk) and optionally adds the
cost of a carry bag if the user chooses to include one. Here's how you can set
this up.


ASSIGN VALUES

Begin the process by assigning prices to each option. Click on the three dots
next to each option and choose Assign values.

Let's say eggs cost 10, bread costs 20 and milk costs 15.

Follow the same process for the second question. A carry bag will cost the user
and extra 5.


ADD A CALCULATION

Find the Calculation component under the Advanced section.

To configure the calculation, we first need to add the first question. You can
either type @ or click on the icon to select questions. First, we select the
question asking for eggs, bread and milk.Click on the + icon, as we will be
doing a sum operation. Then type @ and select the second question. The second
question is about the carry bag.



Now we have a simple formula, which will add up the values of the respective
option the user selects.


ADD PREFIX OR SUFFIX

You can also prefix or suffix to indicate units in the calculator component.
Here, lets add the $ sign as a currency symbol.



Including a Prefix will place it on the left, while a Suffix will appear on the
right.




TEST YOUR CALCULATION

Now that everything is ready, let's see how the calculation looks.



Here the calculator operation has been automatically performed when the user
selected the respective options in the form.