Title: Nested If Statement
Last modified: August 31, 2016

---

# Nested If Statement

 *  Resolved [fergieferg](https://wordpress.org/support/users/fergieferg/)
 * (@fergieferg)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/nested-if-statement/)
 * Hey,
 * I’m having difficulty getting these formulas to work based on multiple criteria.
 * If the male is selected and fieldname5 has value greater than 0 I need fieldname5
   to be multiplied by 1.9. If it is female the fieldname5 value should be multiplied
   by 1.7. And if fieldname5 <= 0 then no multiplication is needed. I’m stuck with
   the following, please help.
 * (function(){
    IF(AND( fieldname5 > 0, fieldname1==’Male’),fieldname5*1.9); IF(
   AND( fieldname5 > 0, fieldname1==’Female’),fieldname5*1.7); })();
 * Thanks,
 * [https://wordpress.org/plugins/calculated-fields-form/](https://wordpress.org/plugins/calculated-fields-form/)

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

 *  Thread Starter [fergieferg](https://wordpress.org/support/users/fergieferg/)
 * (@fergieferg)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/nested-if-statement/#post-7081322)
 * Got it.
 * (function(){
    if(AND(fieldname5>0,fieldname1==’Male’)) return fieldname5*1.9;
   if(AND(fieldname5>0,fieldname1==’Female’)) return fieldname5*1.7; if(fieldname5
   <=0) return fieldname5*1; })();
 *  Plugin Author [codepeople](https://wordpress.org/support/users/codepeople/)
 * (@codepeople)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/nested-if-statement/#post-7081410)
 * Hi,
 * Perfect, and thank you for sharing your solution, however if you have any other
   doubt, do not hesitate in contact me again.
 * Best regards.

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

The topic ‘Nested If Statement’ 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/)

 * 2 replies
 * 2 participants
 * Last reply from: [codepeople](https://wordpress.org/support/users/codepeople/)
 * Last activity: [10 years, 3 months ago](https://wordpress.org/support/topic/nested-if-statement/#post-7081410)
 * Status: resolved