# Value Error - if and statement

jgold20

Board Regular
Joined
Feb 4, 2018
Messages
135
I have a if and statement that I am receiving a value error on. If I just use 1 if statement it works properly. When I add a second if statement, I receive a #Value error




=IF(AND(C3="B",I3="YES"),"Min. Amt / 286","") +
IF(AND(C3="W",I3="YES"),"Min. Amt / 286","")
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
Hi,

You didn't explain the logic behind your formula.
Since C3 can not be "B" and "W" at the same time, I'm assuming C3 can be either B or W, and I3 must be "Yes", then result "Min. Amt / 286", otherwise Blank:


Book1
A
1 
Sheet58
Cell Formulas
RangeFormula
A1=IF(AND(OR(C3={"B","W"}),I3="YES"),"Min. Amt / 286","")
 
Upvote 0
The logic you assumed is correct. I gave only a partial example. With your formula, it works with 1 if statement. If I add a 2nd if statement, I still receive the #value error on the second if statement

=IF(AND(OR(C3={"B","W"}),I3="YES"),"Min. Amt / 286","") +
IF(AND(OR(C3={"MD","MN"}),I3="YES"),"Min. Amt / 300","")
 
Upvote 0
The logic you assumed is correct. I gave only a partial example. With your formula, it works with 1 if statement. If I add a 2nd if statement, I still receive the #value error on the second if statement

=IF(AND(OR(C3={"B","W"}),I3="YES"),"Min. Amt / 286","") +
IF(AND(OR(C3={"MD","MN"}),I3="YES"),"Min. Amt / 300","")

Above in red, might I ask why?
Above in green, no, we've already combined your original 2 IF statements.


Book1
B
1 
Sheet58
Cell Formulas
RangeFormula
B1=IF(I3="YES",IF(OR(C3={"B","W"}),"Min. Amt / 286",IF(OR(C3={"MD","MN"}),"Min. Amt / 300","")),"")
 
Last edited:
Upvote 0
No problem, that happens quite often.
Is it working for you now?
 
Upvote 0
I was just informed that there are additional cells to test 0- same error when I try and use the prior formula:

=IF(I3="YES",IF(OR(C3={"B","W"}),"Min. Amt / 286",IF(OR(C3={"MD","MN"}),"Min. Amt / 300","")),"") +
IF(I3="YES",IF(OR(C4={"B","W"}),"Min. Amt / 286",IF(OR(C4={"MD","MN"}),"Min. Amt / 300","")),"") +
IF(I3="YES",IF(OR(C5={"B","W"}),"Min. Amt / 286",IF(OR(C5={"MD","MN"}),"Min. Amt / 300","")),"") +
IF(I3="YES",IF(OR(C6={"B","W"}),"Min. Amt / 286",IF(OR(C6={"MD","MN"}),"Min. Amt / 300","")),"") +
IF(I3="YES",IF(OR(C7={"B","W"}),"Min. Amt / 286",IF(OR(C7={"MD","MN"}),"Min. Amt / 300","")),"")
 
Upvote 0
Ok, first, I'd like to point out, you can't use the plus sign ( + ) to combine IF conditions like that, the plus sign basically acts like an AND statement, so all those conditions can not be True at the same time

See if this works for you:


Book1
C
1 
Sheet58
Cell Formulas
RangeFormula
C1=IF(I3="YES",IF(OR(SUM(COUNTIF(C3:C7,{"B","W"}))=5),"Min. Amt / 286",IF(OR(SUM(COUNTIF(C3:C7,{"MD","MN"}))=5),"Min. Amt / 300","")),"")
 
Upvote 0
Nothing displays now - below the yes, should display the message "Min. Amt / 286" as "B" is in c3:

=IF(I3="YES",IF(OR(SUM(COUNTIF(C3:C7,{"B","W"}))=5),"Min. Amt / 286",IF(OR(SUM(COUNTIF(C3:C7,{"MD","MN"}))=5),"Min. Amt / 300","")),"")

Bto West: NM,AZ,CA,ND,OR, WA,SD,WA,ID,WY,CO,NE $ 1,500.00 $ 5.24NOYES
L $ 1,500.00 $ -
N $ 1,500.00 $ -
W $ 1,500.00 $ 5.24

<tbody>
</tbody>
 
Last edited:
Upvote 0
EDIT to my above post:

One more thought.

Again, you didn't explain the logic here.

If C3:C7 Has to have either a "B" or "W" in All 5 cells, for the "Min. Amt / 286" result, or
C3:C7 Has to have either "MD" or "MN" in All 5 cells, for the "Min. Amt / 300" result, use formula in C1.

If Only One of the cells C3:C7 need "B" or "W", OR "MD" or "MN", then use formula in D1.


Book1
CD
1  
Sheet58
Cell Formulas
RangeFormula
C1=IF(I3="YES",IF(OR(SUM(COUNTIF(C3:C7,{"B","W"}))=5),"Min. Amt / 286",IF(OR(SUM(COUNTIF(C3:C7,{"MD","MN"}))=5),"Min. Amt / 300","")),"")
D1=IF(I3="YES",IF(OR(SUM(COUNTIF(C3:C7,{"B","W"}))=1),"Min. Amt / 286",IF(OR(SUM(COUNTIF(C3:C7,{"MD","MN"}))=1),"Min. Amt / 300","")),"")
 
Upvote 0

Forum statistics

Threads
1,213,530
Messages
6,114,163
Members
448,554
Latest member
Gleisner2

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top