View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jim Thomlinson Jim Thomlinson is offline
external usenet poster
 
Posts: 5,939
Default Multiple Logical Tests in IF function

Since you are posting in the programming section I assume you are writing
code. That being the case you probably want a Select Case statement...
something like this...

Select Case DEPT1
Case "COMPUTERS"
msgbox "COMPUTERS"
Case "ENGLISH"
msgbox "ENGLISH"
Case "SCIENCE"
msgbox "SCIENCE"
Case Else
msgbox "How did I get here???"
end Select
--
HTH...

Jim Thomlinson


"sandeep" wrote:

dear members,

I want to perform multiple logical test in the IF function, how can i do that.
IF function takes only single logical test. for example :

IF DEPT1=COMPUTERS THEN FIRST ELSE NONE,
IF DEPT1=ENGLISH THEN SECOND ELSE NONE,
IF DEPT1=SCIENCE THEN THIRD ELSE NONE ....... and so on......

as u can see above the IF function should take multiple arguments and
according to the condition should display the result. IF function in excel
only takes one argument .

could any one help me out in this. Is there any function in excel which
takes multiple logical tests.

thanks
regards
sandeep