# 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","")
 
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","")),"")

B
to West: NM,AZ,CA,ND,OR, WA,SD,WA,ID,WY,CO,NE
$ 1,500.00
$ 5.24
NO
YES
L
$ 1,500.00
$ -
N
$ 1,500.00
$ -
W
$ 1,500.00
$ 5.24

<tbody>
</tbody>

Read my post #10 .
 
Upvote 0

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
I tried both examples and both returned blanks. To answer your question:

At any given time, there will be many different values in C3:C7. I only want to display divide by 286 for "B" and "W" and divide by 300 for "MD and "MN". For the time being, all other alpha values in C3:C7 can default to a message divide by 200
 
Last edited:
Upvote 0
Won't be able to help you any further tonight (3 am where I am). Might be back on sometime tomorrow.

It would Really help if you explain what you're trying to do for your helpers to help you.

We don't know what you're working on, we don't know what you're thinking, we don't know the lay out of your data, etc. We can only rely on what you Tell Us, to try to Help You solve Your Problem.
 
Upvote 0
I tried both examples and both returned blanks. To answer your question:

There can be many different values in C3:C7 at any given time. I only want to display divide by 286 for "B" and "W". I want to divide by 300 for "MD and "MN". For the time being, all other alpha values in C3:C7 can default to a message divide by 200

Ok, 15 more minutes.

So what happens if C3 is "B", and C4 is "MD"?

Are you looking for a result per LINE?
 
Upvote 0
Please post a sample table like your Post #9 WITH ALL expected results.
 
Upvote 0
C3:C7 will have an alpha value at all times. They will never have the same alpha value.
After giving the problem additional thought:

1) c3:c7 = one of the above (MD, MN, B, W), display appropriate / message
2) c3:c7 = two of them at the same time (can happen more than once in c3:c7) (MD, MN), (B, W), display both(286, 300) / by messages.
3) Number 2 above plus c3:c7= any other alpha combination, display - / 286, /300 and / 200

Company CodeSpecial InstructionsEnter Min. Move Amt.Min.Price per CF Filing OR Scheduling & CC FeesMinimum Move
Bto West: NM,AZ,CA,ND,OR, WA,SD,WA,ID,WY,CO,NE $ 1,500.00 $ 5.24NOYES
L $ 1,500.00 $ -Message here
N $ 1,500.00 $ -
W $ 1,500.00 $ 5.24
$ -

<tbody>
</tbody>
 
Last edited:
Upvote 0
Hi!

If I understand correctly what you want, maybe the formula below can helps:

=IF(I3="YES",IF(SUM(COUNTIF(C3:C7,{"B","W","MD","MN"})),"Min. Amt ","")&
IF(SUM(COUNTIF(C3:C7,{"B","W"})),"/ 286",""))&" "&
IF(I3="YES",IF(SUM(COUNTIF(C3:C7,{"MD","MN"})),"/ 300","")&" "&
IF(I3="YES",IF(SUM(COUNTIF(C3:C7,{"B","W"}))*SUM(COUNTIF(C3:C7,{"MD","MN"}))*
(SUM(COUNTIF(C3:C7,"?*"))-SUM(COUNTIF(C3:C7,{"B","W","MD","MN"}))),"/ 200",""),""))


Or

=IF(I3="YES",IF(SUM(COUNTIF(C3:C7,{"B","W","MD","MN"})),"Min. Amt","")&
IF(SUM(COUNTIF(C3:C7,{"B","W"}))," / 286",""))&
IF(I3="YES",IF(SUM(COUNTIF(C3:C7,{"MD","MN"}))," / 300","")&
IF(I3="YES",IF(SUM(COUNTIF(C3:C7,{"B","W"}))*SUM(COUNTIF(C3:C7,{"MD","MN"}))*
(SUM(COUNTIF(C3:C7,"?*"))-SUM(COUNTIF(C3:C7,{"B","W","MD","MN"})))," / 200",""),""))


Markmzz
 
Last edited:
Upvote 0
In terms I think I can express now:

If C3:C7 = B, W display / 286
If C3:C7 = MD, MN display / 300
If C3:C7 = H, V, X, etc. display / 200
If C3:C7 = Any combination above(B, MD, H) display /286, /300, /200
 
Upvote 0

Forum statistics

Threads
1,215,026
Messages
6,122,743
Members
449,094
Latest member
dsharae57

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