Forum Discussion
Perplexed!! Why does this not work? "OR" criteria added to a working formula
- Feb 09, 2019
Sorry, it excludes it if OR condition. To exclude from AND it could be like
=IF(AND( IF($D21>0,$AB30<$AC30,1), IF($F21>0,$AD30<$AE30,1), IF($H21>0,$AF30<$AG30,1), IF($J21>0,$AH30<$AI30,1), $AJ30<$AK30, $AL30<$AM30, $AN30<$AO30, $AP30<$AQ30), $Q30/$P30,"")
If D21 is negative first IF returns TRUE independently of what is in AB30 and AC30 and that doesn't affect other conditions under AND. Please see attached.
If you'd like to remove $AB30<$AC30 if D21 is negative you may use
($AB30<$AC30)*($D$21>=0)
it gives FALSE if D21 is negative and result of AB30, AC30 comparison otherwise.
with ($AB30<$AC30)*($D$21>=0). Do I replace parentheses with 'quote' symbol? Can you give example?
- SergeiBaklanFeb 09, 2019Diamond Contributor
Sorry, it excludes it if OR condition. To exclude from AND it could be like
=IF(AND( IF($D21>0,$AB30<$AC30,1), IF($F21>0,$AD30<$AE30,1), IF($H21>0,$AF30<$AG30,1), IF($J21>0,$AH30<$AI30,1), $AJ30<$AK30, $AL30<$AM30, $AN30<$AO30, $AP30<$AQ30), $Q30/$P30,"")
If D21 is negative first IF returns TRUE independently of what is in AB30 and AC30 and that doesn't affect other conditions under AND. Please see attached.
- Greg BonaparteFeb 11, 2019Iron ContributorSergei, I just realized that one issue is not solved. See final formula below:
=IF(AND(
IF($D$21>0,$AB30<$AC30,1),
IF($F$21>0,$AD30<$AE30,1),
IF($H$21>0,$AF30<$AG30,1),
$AH30<$AI30,
$AJ30<$AK30,
$AL30<$AM30,
$AN30<$AO30,
$AP30<$AQ30),
$Q30/$P30,"")
I need the formula to become "not true" if D21 thru H21 is negative. Thank you so much for your assistence- SergeiBaklanFeb 11, 2019Diamond Contributor
Hi Greg,
Sorry, I missed. Do you need the entire formula returns FALSE if ANY of D21, F21, H21 is negative? Or only all combinations of $AB30<$AC30, $AD30<$AE30, $AF30<$AG30 are ignored if any of D21, F21, H21 is negative?
Current formula excludes $AB30<$AC30 if D21 is negative; $AD30<$AE30 if F21 negative and the same for the third combination.
How the formula works you may check if stay on the cell with formula, on ribbon click Formulas->Evaluate formula, it shows step by step all calculations.
- Greg BonaparteFeb 10, 2019Iron Contributor
This worked perfectly. Thank you!!!!!