If and OR

yichuansancun

Board Regular
Joined
Feb 7, 2011
Messages
123
I have the following formula:

=IF(OR($B$38=0,ISERROR($B$38)),"not available",$B$38)

When B38 = 0, it returns "not available"
but when B38 = "#DIV/0" or any other error message, it doesn't return "not available" but the error symbol itself.

Why is that?

How can I make the cell to return "not available" when either of the conditions met?

Thanks,
Perri
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
Try this

=IF(ISERROR($B$38),"not available",IF($B$38=0,"not available",$B$38))

M.
 
Upvote 0
Try
Code:
=IF(ISERROR($B$38),"not available",IF($B$38=0,"not available",$B$38))
 
Upvote 0
Sorry... it was more complicated then I stated early:

Here is the formula that does NOT work:

=IF(OR(AND(Neighborhood<>"",Furnishing<>"",C24<>"",Bedrms<>"",ISERROR($B$38)),$B$38=0),”not available”,(IF(ISERROR($B$38),"please select",$B$38)))

What I try to achieve:

If B38 is error and all the selections (Neighborhood, furnishing, C24, bedrms) are not empty, OR if B38=0, then the result should be "not available"

however,

if B38 is error and one of the selections is empty, the result should be "please select"

Does it make sense?

Thanks in advance!
 
Upvote 0
In addition, when I tested the OR statement by F9, it gives me "true", so I think the OR portion is correct, but it doesn't work.... :(
 
Upvote 0
Maybe this

=IF($B$38=0,"not available",IF(ISERROR($B$38), IF(AND(Neighborhood<>"",Furnishing<>"",C24<>"",Bedrms<>""),"not available","please select"),$B$38))

M.
 
Last edited:
Upvote 0
Your formula doesn't work :-(

I solved the problem by breaking the formulas into the following three steps:

the value in C38 determines all the return value

Step 1
C37 = IF(AND(Neighborhood<>"",Furnishing<>"",C24<>"",Bedrms<>"",ISERROR(B38)),"not available",B38)

then goes to Step 2
C36 = F(C37=0,"not available",C37)

then goes to Step 3
=IF(ISERROR(C36),"please select",C36*12)

The value in Step 3 is my final result. It worked but it sucks that I cannot combine the three steps into 1 :(:confused:

any more thoughts?

Thanks!
 
Upvote 0
Sorry my formulas was wrong

This should work

=IF(ISERROR($B$38), IF(AND(Neighborhood<>"",Furnishing<>"",C24<>"",Bedrms<>""),"not available","please select"),IF($B$38=0,0,$B$38))

M.
 
Upvote 0
it worked except when B38 = 0, it should return "not available", so I altered the formula to :

=IF(ISERROR($B$38), IF(AND(Neighborhood<>"",Furnishing<>"",C24<>"",Bedrms<>""),"not available","please select"),IF($B$38=0,"not available",$B$38))

Thanks much for you help!!!!

Perri
 
Upvote 0
it worked except when B38 = 0, it should return "not available", so I altered the formula to :

=IF(ISERROR($B$38), IF(AND(Neighborhood<>"",Furnishing<>"",C24<>"",Bedrms<>""),"not available","please select"),IF($B$38=0,"not available",$B$38))

Thanks much for you help!!!!

Perri

Hi Perri,

Yes... B38 = 0 ---> not available

Good that you fixed it!

Glad to help :)

M.
 
Upvote 0

Forum statistics

Threads
1,224,597
Messages
6,179,808
Members
452,944
Latest member
2558216095

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