ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   if then statement with 16 constraints and 1 equation (https://www.excelbanter.com/excel-programming/371196-if-then-statement-16-constraints-1-equation.html)

Fish

if then statement with 16 constraints and 1 equation
 
Hello,

Is it possible to constuct a 16 constraint nested if then statement using
one equation as the control equation? Is there a better way to do this?
Please advise...

Regards,

Fish



Don Guillett

if then statement with 16 constraints and 1 equation
 
more info and a sample would be helpful

--
Don Guillett
SalesAid Software

"Fish" wrote in message
...
Hello,

Is it possible to constuct a 16 constraint nested if then statement using
one equation as the control equation? Is there a better way to do this?
Please advise...

Regards,

Fish





Die_Another_Day

if then statement with 16 constraints and 1 equation
 
How about the Select Case?
Sub CaseTest()
Select Case Range("A1").Value
Case 1
MsgBox "1"
Case 2
MsgBox "2"
Case Else
MsgBox "Not 1 or 2"
End Select
End Sub

Change the Cases as needed

Charles

Fish wrote:
Hello,

Is it possible to constuct a 16 constraint nested if then statement using
one equation as the control equation? Is there a better way to do this?
Please advise...

Regards,

Fish



David

if then statement with 16 constraints and 1 equation
 
Hi,

I thought you could only nest 7 if Statements, so I am with the Select Case
too.
--
David


"Fish" wrote:

Hello,

Is it possible to constuct a 16 constraint nested if then statement using
one equation as the control equation? Is there a better way to do this?
Please advise...

Regards,

Fish



Don Guillett

if then statement with 16 constraints and 1 equation
 
Actually there are many ways around the 7 nested limit. One is nest 7 + nest
7

--
Don Guillett
SalesAid Software

"David" wrote in message
...
Hi,

I thought you could only nest 7 if Statements, so I am with the Select
Case
too.
--
David


"Fish" wrote:

Hello,

Is it possible to constuct a 16 constraint nested if then statement using
one equation as the control equation? Is there a better way to do this?
Please advise...

Regards,

Fish





Fish

if then statement with 16 constraints and 1 equation
 
Here is my sample equation:
=IF(M2=N2,IF(P2=0,((R2-(R2*0.35)-M2)/R2),((P2-(P2*0.35)-M2)/P2)),IF(N2=0,((R2-(R2*0.35)-M2)/R2),"FALSE"))

There are four colums of data and a total of 16 differnet combinations based
on statistics. These are not the actual numbers but here are all of the
combinations:

M N O P

1 0 1 1
0 0 0 1
0 0 1 1
0 1 1 1
1 1 1 1
1 0 0 0
1 1 0 0
1 1 1 0
0 1 0 0
0 0 1 0
0 1 1 0
1 1 0 1
1 0 0 1
0 0 0 0
0 1 0 1
1 0 1 0

Here are the constrainsts:

1. If M=N compute the equation
2. If M is unequal to N give a value of false
3. If a value exist for O and P use the value for O
4. If a value of zero is used for the O colums use the value for P to
compute the equation.

I hope this helps.

Thanks for your assistance,

Fish

"Don Guillett" wrote:

more info and a sample would be helpful

--
Don Guillett
SalesAid Software

"Fish" wrote in message
...
Hello,

Is it possible to constuct a 16 constraint nested if then statement using
one equation as the control equation? Is there a better way to do this?
Please advise...

Regards,

Fish






Fish

if then statement with 16 constraints and 1 equation
 
Please note P=R

"Fish" wrote:

Here is my sample equation:
=IF(M2=N2,IF(P2=0,((R2-(R2*0.35)-M2)/R2),((P2-(P2*0.35)-M2)/P2)),IF(N2=0,((R2-(R2*0.35)-M2)/R2),"FALSE"))

There are four colums of data and a total of 16 differnet combinations based
on statistics. These are not the actual numbers but here are all of the
combinations:

M N O P

1 0 1 1
0 0 0 1
0 0 1 1
0 1 1 1
1 1 1 1
1 0 0 0
1 1 0 0
1 1 1 0
0 1 0 0
0 0 1 0
0 1 1 0
1 1 0 1
1 0 0 1
0 0 0 0
0 1 0 1
1 0 1 0

Here are the constrainsts:

1. If M=N compute the equation
2. If M is unequal to N give a value of false
3. If a value exist for O and P use the value for O
4. If a value of zero is used for the O colums use the value for P to
compute the equation.

I hope this helps.

Thanks for your assistance,

Fish

"Don Guillett" wrote:

more info and a sample would be helpful

--
Don Guillett
SalesAid Software

"Fish" wrote in message
...
Hello,

Is it possible to constuct a 16 constraint nested if then statement using
one equation as the control equation? Is there a better way to do this?
Please advise...

Regards,

Fish







All times are GMT +1. The time now is 06:38 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com