Title: Predefined Result
Last modified: June 28, 2020

---

# Predefined Result

 *  Resolved [shaon007](https://wordpress.org/support/users/shaon007/)
 * (@shaon007)
 * [5 years, 11 months ago](https://wordpress.org/support/topic/predefined-result/)
 * Hi,
 * I want to set some predefined result if the calculation result is more than expectation.
 * For example:
    Our limit is +8, so if the result is more than that then result
   always will be +8.
 * e.g.
    if result is +8 it should be +8 if result is +9 it should be +8 if result
   is +10 it should be +8 if result is +7 it should be +7
 * Can you please help?
 * Thanks

Viewing 9 replies - 1 through 9 (of 9 total)

 *  Plugin Author [codepeople](https://wordpress.org/support/users/codepeople/)
 * (@codepeople)
 * [5 years, 11 months ago](https://wordpress.org/support/topic/predefined-result/#post-13044537)
 * Hello [@shaon007](https://wordpress.org/support/users/shaon007/)
 * You should simply to use the MIN operation.
 * MIN(X,Y,Z) returns the minimum value between X,Y, or Z (or any other parameter
   passed to the operation).
 * So, assuming the current equation is: fieldname1+fieldname2
 * Edit it as follows:
 *     ```
       MIN(fieldname1+fieldname2, 8)
       ```
   
 * and that’s all.
    Best regards.
 *  Thread Starter [shaon007](https://wordpress.org/support/users/shaon007/)
 * (@shaon007)
 * [5 years, 11 months ago](https://wordpress.org/support/topic/predefined-result/#post-13044688)
 * Thanks for your reply.
 * This is my equation
 * IF(fieldname4<0.0,ROUND(fieldname4+(fieldname3/2)),ROUND(fieldname4-(fieldname3/
   2)))
 * How do I use MIN() here?
 *  Plugin Author [codepeople](https://wordpress.org/support/users/codepeople/)
 * (@codepeople)
 * [5 years, 11 months ago](https://wordpress.org/support/topic/predefined-result/#post-13044692)
 * Hello [@shaon007](https://wordpress.org/support/users/shaon007/)
 *     ```
       MIN(8,IF(fieldname4<0,ROUND(fieldname4+fieldname3/2),ROUND(fieldname4-fieldname3/2)))
       ```
   
 * Best regards.
 *  Thread Starter [shaon007](https://wordpress.org/support/users/shaon007/)
 * (@shaon007)
 * [5 years, 11 months ago](https://wordpress.org/support/topic/predefined-result/#post-13044698)
 * Thanks sir
 *  Thread Starter [shaon007](https://wordpress.org/support/users/shaon007/)
 * (@shaon007)
 * [5 years, 11 months ago](https://wordpress.org/support/topic/predefined-result/#post-13044709)
 * Another question sir..
 * If your lower limit is +1.5 but the result comes out +1.0 then, how I will make
   it +1.5
 *  Plugin Author [codepeople](https://wordpress.org/support/users/codepeople/)
 * (@codepeople)
 * [5 years, 11 months ago](https://wordpress.org/support/topic/predefined-result/#post-13044716)
 * Hello [@shaon007](https://wordpress.org/support/users/shaon007/)
 * In the same way you used the MIN operation, you should use the MAX one:
 *     ```
       MAX(1.5, MIN(8,IF(fieldname4<0,ROUND(fieldname4+fieldname3/2),ROUND(fieldname4-fieldname3/2))))
       ```
   
 * Best regards.
 *  Thread Starter [shaon007](https://wordpress.org/support/users/shaon007/)
 * (@shaon007)
 * [5 years, 11 months ago](https://wordpress.org/support/topic/predefined-result/#post-13044851)
 * That is working but we are still facing a problem.
    Actually we are building 
   a “sphere cylinder spectacle calculator”
 * we can divide the situation into 2 case:
 * case 1:
    for negative number the limit is -6.0 to -1.5, so if the result is -
   7.0 then it will be -6.0 or if result is -1.0 then it will be -1.5
 * case 2:
    for positive number the limit is +8.0 to +1.0, so if the result is +
   9.0 then it will be +8.0 or if result is +0.5 then it will be +1.0
 * This is the actual scenario.
 * Can you please help?
 *  Plugin Author [codepeople](https://wordpress.org/support/users/codepeople/)
 * (@codepeople)
 * [5 years, 11 months ago](https://wordpress.org/support/topic/predefined-result/#post-13044903)
 * Hello,
 * In this case you should move the MIN and MAX operations into the IF operation:
 *     ```
       IF(fieldname4<0,MIN(MAX(ROUND(fieldname4+fieldname3/2),-6),-1.5),MIN(MAX(ROUND(fieldname4-fieldname3/2), 1, 8)))
       ```
   
 * I’m sorry, but the support service does not cover the implementation of the users’
   projects (forms or formulas). If you need additional support to implement your
   proejct’s formulas, you can contact me through my private website: [Customization](https://cff.dwbooster.com/customization)
 * Best regards.
 *  Thread Starter [shaon007](https://wordpress.org/support/users/shaon007/)
 * (@shaon007)
 * [5 years, 11 months ago](https://wordpress.org/support/topic/predefined-result/#post-13044909)
 * Thanks sir for you quick reply and helping me. This will help me a lot.
    If I
   need any further implementation I will definitely ask for customization.

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘Predefined Result’ is closed to new replies.

 * ![](https://ps.w.org/calculated-fields-form/assets/icon-256x256.jpg?rev=1734377)
 * [Calculated Fields Form](https://wordpress.org/plugins/calculated-fields-form/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/calculated-fields-form/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/calculated-fields-form/)
 * [Active Topics](https://wordpress.org/support/plugin/calculated-fields-form/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/calculated-fields-form/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/calculated-fields-form/reviews/)

 * 9 replies
 * 2 participants
 * Last reply from: [shaon007](https://wordpress.org/support/users/shaon007/)
 * Last activity: [5 years, 11 months ago](https://wordpress.org/support/topic/predefined-result/#post-13044909)
 * Status: resolved