Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default Logical Testing

How do I set up a logical_test formula with three variable options? For
example: I have a formula that returns a true or false answer, if true the
result will be A, If false it will be B. Now I need to enhance the formula
to include a second test that returns C
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default Logical Testing

You don't give enough information - which test should be applied first?

Assume Formula1:

If Formula1 Then
sResult = "A"
Else
If Formula2 Then
sResult = "C"
Else
sResult = "B"
End If
End If

which can be more compactly written:

If Formula1 Then
sResult = "A"
ElseIf Formula2 Then
sResult = "C"
Else
sResult = "B"
End If

or

sResult = IIf(Formula1, "A", IIf(Formula2, "C", "B"))

In article ,
"Lance" wrote:

How do I set up a logical_test formula with three variable options? For
example: I have a formula that returns a true or false answer, if true the
result will be A, If false it will be B. Now I need to enhance the formula
to include a second test that returns C

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default Logical Testing

JE,

You're absolutely correct, but, your response took that into consideration.
I am a novice at programming. Regarding which test should be performed
first, it didn't really matter, cause if the test resulted in false then the
next test would perform until the result was true. What I didn't tell you is
that the test was going to be performed after a user selected A, B or C from
a drop down box. It appears as though the latter code is closest to what I
needed because I am going to place the code in the formula window of an excel
spreadsheet. As a matter of fact here is the code I came up with and am
going to use. It just took me most of the day to figure the code.
=IF('Master Input Table'!$D$8="VQE","MM24V",IF('Master Input
Table'!$D$8="VQE1","MM24VE",IF('Master Input Table'!$D$8="DS0","MM24NB")))

Tx,

Lance


"JE McGimpsey" wrote:

You don't give enough information - which test should be applied first?

Assume Formula1:

If Formula1 Then
sResult = "A"
Else
If Formula2 Then
sResult = "C"
Else
sResult = "B"
End If
End If

which can be more compactly written:

If Formula1 Then
sResult = "A"
ElseIf Formula2 Then
sResult = "C"
Else
sResult = "B"
End If

or

sResult = IIf(Formula1, "A", IIf(Formula2, "C", "B"))

In article ,
"Lance" wrote:

How do I set up a logical_test formula with three variable options? For
example: I have a formula that returns a true or false answer, if true the
result will be A, If false it will be B. Now I need to enhance the formula
to include a second test that returns C


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
Help!!! - logical function for someone not very logical ECH123 Excel Worksheet Functions 3 May 11th 09 04:14 PM
Testing Jay T. Emory[_2_] Excel Discussion (Misc queries) 0 February 18th 09 08:55 PM
Logical Testing Afsha Excel Discussion (Misc queries) 4 June 26th 07 07:14 PM
testing Mitchina New Users to Excel 2 June 21st 05 04:35 PM
testing Juco Excel Worksheet Functions 2 January 31st 05 01:13 AM


All times are GMT +1. The time now is 10:41 PM.

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

About Us

"It's about Microsoft Excel"