Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
J@Y J@Y is offline
external usenet poster
 
Posts: 127
Default Having "Or" in an If statement doesn't work?

I was trying this statement:

If a = 2 or b =2 then .....

But the b = 2 doesn't get tested for some reason, why is that?
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,311
Default Having "Or" in an If statement doesn't work?

One way:

=IF(OR(A2=2,B2=2),TRUE,FALSE)

HTH,
Paul


"J@Y" wrote in message
...
I was trying this statement:

If a = 2 or b =2 then .....

But the b = 2 doesn't get tested for some reason, why is that?



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 227
Default Having "Or" in an If statement doesn't work?

On Jun 15, 11:13 am, J@Y wrote:
I was trying this statement:

If a = 2 or b =2 then .....

But the b = 2 doesn't get tested for some reason, why is that?


It will work in VBA, but not in a cell formula. In a cell the format
is:

=IF(OR(A=2,B=2),[do if true],[do if false])

Mark Lincoln

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,344
Default Having "Or" in an If statement doesn't work?

Hi,

It's not clear from your question whether you are doing this in the
spreadsheet or in code.

IF in code:

IF a=2 OR b=2 then
...
End IF

or

IF a=2 XOR b=2 then
....
End IF

In the spreadsheet there is no XOR option you would need to make a more
complicated formula.

--
Cheers,
Shane Devenshire


"J@Y" wrote:

I was trying this statement:

If a = 2 or b =2 then .....

But the b = 2 doesn't get tested for some reason, why is that?

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
embedding "ISERROR" function into an "IF" statement [email protected] Excel Worksheet Functions 8 January 4th 07 12:01 AM
HELP on "left","right","find","len","substitute" functions serene83 Excel Discussion (Misc queries) 5 June 27th 06 02:23 AM
Count occurences of "1"/"0" (or"TRUE"/"FALSE") in a row w. conditions in the next BCB New Users to Excel 7 May 13th 06 10:02 PM
IF statement does not work with "=" sign BBinSimi Excel Worksheet Functions 2 May 1st 06 07:00 PM
pictures to work with "data" "sort" option arad Excel Discussion (Misc queries) 1 April 18th 06 09:15 PM


All times are GMT +1. The time now is 05:53 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"