# 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

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
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","")),"")

[TABLE="width: 675"]
<tbody>[TR]
[TD="class: xl76, width: 95, align: center"]B[/TD]
[TD="class: xl82, width: 183, colspan: 2, align: center"]to West: NM,AZ,CA,ND,OR, WA,SD,WA,ID,WY,CO,NE[/TD]
[TD="class: xl80, width: 105, align: center"] $ 1,500.00[/TD]
[TD="class: xl81, width: 95, align: center"] $ 5.24[/TD]
[TD="class: xl77, width: 104, align: center"]NO[/TD]
[TD="class: xl84, width: 93, align: center"]YES[/TD]
[/TR]
[TR]
[TD="class: xl78, align: center"]L[/TD]
[TD="class: xl83, width: 183, colspan: 2, align: center"][/TD]
[TD="class: xl80, width: 105, align: center"] $ 1,500.00[/TD]
[TD="class: xl79, align: center"] $ -[/TD]
[TD="class: xl73"][/TD]
[TD="class: xl85, width: 93, align: center"][/TD]
[/TR]
[TR]
[TD="class: xl74, align: center"]N[/TD]
[TD="class: xl82, width: 183, colspan: 2, align: center"][/TD]
[TD="class: xl80, width: 105, align: center"] $ 1,500.00[/TD]
[TD="class: xl75, align: center"] $ -[/TD]
[TD="class: xl70"][/TD]
[TD="class: xl72, align: center"][/TD]
[/TR]
[TR]
[TD="class: xl74, align: center"]W[/TD]
[TD="class: xl82, width: 183, colspan: 2, align: center"][/TD]
[TD="class: xl80, width: 105, align: center"] $ 1,500.00[/TD]
[TD="class: xl75, align: center"] $ 5.24[/TD]
[TD="class: xl70"][/TD]
[TD="class: xl72, align: center"][/TD]
[/TR]
</tbody>[/TABLE]
 
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,224,823
Messages
6,181,176
Members
453,021
Latest member
Justyna P

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