# How can I conditionally subtract the lowest value when selected options is more than 4

**AZDBAdesze**Looking to see if the JotForm can handle the following:

A user chooses four options at the value of the following

$650

$650

$250

$50

$100

Total Due $1700

But need to look for the smallest amount and subtract that amount from the Total Due which gives a new Total Due of $1650. The only way this subtraction is target is when a person choose more than 4 options.

If you need to see my form to help let me know.

Thanks

- JotForm Support
**Jim_R**Are these fixed values - Meaning, the values of your options will be 650, 650, 250, 100 and 50? If they are, then all you need are two things:

1. The

**count()**function, so you can count the number of options that were selected**Related guide: Form-Calculation-Math-Function-Reference**2. Then, use that counted result in your condition, whether you'll deduct 50 or not

For this, you can use the

**Form Calculation Widget**which will be used to count the number of options selected:Afterwards, setup the

**Condition**to deduct 50 if the user selected more than 4:See it in action here:

**https://www.jotform.com//73571517243961****Related guide:****How-to-Clone-an-Existing-Form-from-a-URL** **AZDBAdesze**So the 50 was just an example.

I looked at your form but no Total amount can back.

This is what I looking for the calculation to do.

650+650+250+100 = 1,550 the lowest amount of the four options is not calculated

650+250+50+100 = 1,000 the lowest amount of the four options is not calculated

So no matter how many options the user chooses out of the four options the calculations should look for the lowest amount and subtract it from the overall total. Thank of it as buy three and get the third one free, but the free is the lowest price point.

So that is what I am not seeing in your response or on the form.

I know it is complex.

Merry Christmas

**Ardian_L**It is possible to use the min() function, please check the demo form I have created below: https://form.jotform.com/73582376165969

So it will automatically find the minimum value and will pick that one. This is the only option to use the min function. You can clone this form and modify it based on your needs. Please let us know if you have any other question.

**AZDBAdesze**Ardian_L

Ok you have given the best solution, but when I cloned the form the results came back weird. Then I added more options to see how the form would behave and it didn't like it so what else did you do?

I copied to link of your cloned form.

I could not tell what the symbol is on the Lowest value after each value.

https://form.jotform.com/73582015284153

**TREVON**Kindly try cloning this form. It will give you lowest value of selected Check boxes. Kindly note that if one checkbox is not selected the value is 0 hence you must at least select all the check boxes and it will display the lowest figure in the selection.

Kindly see below the calculation used to display minimum value

**AZDBAdesze**I don't understand what Trevon is telling me.

Ardian_L you gave me the best solution, but when I cloned the form the results came back weird. Then I added more options to see how the form would behave and it didn't like it so what else did you do?

I copied the link of your cloned form.

I could not tell what the symbol you used on the Lowest value after each option on the Form Calculation Widget.

https://form.jotform.com/73582015284153

I need someone that can help like Ardian_L did. Thank you.

- JotForm Support
**BJoanna**The result is not correct on your cloned form because the new options that you added are not separated correctly. A comma should be set as a number and not as a string. To resolve this issue simply click on each comma that you added inside of the calculation that you set.

Here is my cloned form: https://form.jotform.com/73590999231973

Please note that with the solution my colleague provided you, the lowest value will be calculated only when all options are selected.

**AZDBAdesze**Thank BJoanna

I was able to achieve what I needed by coming up with a new solution.

I am still working on what you and your colleague have provided. I appreciate the teams helps.

Merry Christmas!!!

- JotForm Support
**EltonCris**We are happy to hear it. Just let us know whenever you need assistance.

Merry Christmas! :)