473,378 Members | 1,106 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Nested IIF expression doesn't return 3rd condition!

Bob
I'm not sure why this doesn't work...

EACRank: IIf([Current EAC Gross Margin]>20,"1",IIf([Current EAC Gross
Margin]<14.99,"3",IIf(([Current EAC Gross Margin]>14.99) And ([Current
EAC Gross Margin]<19.99),"2")))

The first condition returns a 1 as desired.
The second condition returns a 3
The third condition returns a 1 instead of a 2.

Can anyone help?

Thanks in advance,

Bob

May 3 '07 #1
6 5716
GH
Just a suggestion, but wouldn't a SWITCH function be more practical
and less onerous to decipher?

EACRank: Switch([Current EAC Gross Margin]>19.99,1,[Current EAC Gross
Margin] BETWEEN 14.99 And 19.99,2,[Current EAC Gross Margin]<14.99,3)

Currently, your IIF statement, using and < eliminates values of
14.99, 19.99, and 20 from your rankings. Using the format provided
above would include these values.

- GH

On May 3, 9:47 am, Bob <techno...@bellsouth.netwrote:
I'm not sure why this doesn't work...

EACRank: IIf([Current EAC Gross Margin]>20,"1",IIf([Current EAC Gross
Margin]<14.99,"3",IIf(([Current EAC Gross Margin]>14.99) And ([Current
EAC Gross Margin]<19.99),"2")))

The first condition returns a 1 as desired.
The second condition returns a 3
The third condition returns a 1 instead of a 2.

Can anyone help?

Thanks in advance,

Bob

May 3 '07 #2
Current EAC Gross Margin, Return Value
less than 15, 3
greater than 20, 1
greater than 15 and less than 20, 2
exactly 20, ?
exactly 15, ?

I would suspect that this would suit your needs:

EAC Rank: iif([Current EAC Gross Margin]>=20, "1", iif([Current EAC
Gross Margin]<15, "3", "2")

Current EAC Gross Margin, Return Value
20 to +inifinity including 20, 1
15 to 20 including 15, 2
evrything else, 3

Cheers,
Jason Lepack
On May 3, 9:47 am, Bob <techno...@bellsouth.netwrote:
I'm not sure why this doesn't work...

EACRank: IIf([Current EAC Gross Margin]>20,"1",IIf([Current EAC Gross
Margin]<14.99,"3",IIf(([Current EAC Gross Margin]>14.99) And ([Current
EAC Gross Margin]<19.99),"2")))

The first condition returns a 1 as desired.
The second condition returns a 3
The third condition returns a 1 instead of a 2.

Can anyone help?

Thanks in advance,

Bob

May 3 '07 #3
On 3 May 2007 06:47:27 -0700, Bob <te*******@bellsouth.netwrote:

To test 3 conditions you only need 2 IIf functions.
-Tom.

>I'm not sure why this doesn't work...

EACRank: IIf([Current EAC Gross Margin]>20,"1",IIf([Current EAC Gross
Margin]<14.99,"3",IIf(([Current EAC Gross Margin]>14.99) And ([Current
EAC Gross Margin]<19.99),"2")))

The first condition returns a 1 as desired.
The second condition returns a 3
The third condition returns a 1 instead of a 2.

Can anyone help?

Thanks in advance,

Bob
May 3 '07 #4
Bob
On May 3, 10:03 am, GH <borgcollectiv...@gmail.comwrote:
Just a suggestion, but wouldn't a SWITCH function be more practical
and less onerous to decipher?

EACRank: Switch([Current EAC Gross Margin]>19.99,1,[Current EAC Gross
Margin] BETWEEN 14.99 And 19.99,2,[Current EAC Gross Margin]<14.99,3)

Currently, your IIF statement, using and < eliminates values of
14.99, 19.99, and 20 from your rankings. Using the format provided
above would include these values.

- GH

On May 3, 9:47 am, Bob <techno...@bellsouth.netwrote:
I'm not sure why this doesn't work...
EACRank: IIf([Current EAC Gross Margin]>20,"1",IIf([Current EAC Gross
Margin]<14.99,"3",IIf(([Current EAC Gross Margin]>14.99) And ([Current
EAC Gross Margin]<19.99),"2")))
The first condition returns a 1 as desired.
The second condition returns a 3
The third condition returns a 1 instead of a 2.
Can anyone help?
Thanks in advance,
Bob- Hide quoted text -

- Show quoted text -
Thanks for your quick response! I must be doing something wrong using
the switch function. The third condition is now null.

May 3 '07 #5
Bob
On May 3, 10:05 am, Jason Lepack <jlep...@gmail.comwrote:
Current EAC Gross Margin, Return Value
less than 15, 3
greater than 20, 1
greater than 15 and less than 20, 2
exactly 20, ?
exactly 15, ?

I would suspect that this would suit your needs:

EAC Rank: iif([Current EAC Gross Margin]>=20, "1", iif([Current EAC
Gross Margin]<15, "3", "2")

Current EAC Gross Margin, Return Value
20 to +inifinity including 20, 1
15 to 20 including 15, 2
evrything else, 3

Cheers,
Jason Lepack
On May 3, 9:47 am, Bob <techno...@bellsouth.netwrote:
I'm not sure why this doesn't work...
EACRank: IIf([Current EAC Gross Margin]>20,"1",IIf([Current EAC Gross
Margin]<14.99,"3",IIf(([Current EAC Gross Margin]>14.99) And ([Current
EAC Gross Margin]<19.99),"2")))
The first condition returns a 1 as desired.
The second condition returns a 3
The third condition returns a 1 instead of a 2.
Can anyone help?
Thanks in advance,
Bob- Hide quoted text -

- Show quoted text -
Thanks for getting back to me so quickly! It works but negitive
numbers don't come up as 3.

Any ideas?

Thanks,

Bob

May 3 '07 #6
Bob
On May 3, 9:47 am, Bob <techno...@bellsouth.netwrote:
I'm not sure why this doesn't work...

EACRank: IIf([Current EAC Gross Margin]>20,"1",IIf([Current EAC Gross
Margin]<14.99,"3",IIf(([Current EAC Gross Margin]>14.99) And ([Current
EAC Gross Margin]<19.99),"2")))

The first condition returns a 1 as desired.
The second condition returns a 3
The third condition returns a 1 instead of a 2.

Can anyone help?

Thanks in advance,

Bob
Got it to work! Thanks everyone!

May 3 '07 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Börni | last post by:
Hi, I have an sql query like this: SELECT column FROM table WHERE column1="3" AND column2="1" This query works perfectly if i run it in the command line, to be exactly it return two results. But...
7
by: jason | last post by:
Pardon the perl noobie post, this one is silly one I'm sure, but nonetheless, I'm stuck on it. why doesn't $_ substitute with the data when the program is passed the string as such. The eventual...
3
by: ricky | last post by:
I want to return with only one xpath expression the first following node relative to a node with a XPTO attribute. Example: <node> xxx </node> <node XPTO="true"> yyy
7
by: steve bull | last post by:
I have the following code snippet to read the colorRange attributes for the colorRangeSwatch in the xml file listed below. string expr = "/swatches/colorRangeSwatch/colorRange";...
11
by: Savas Ates | last post by:
CREATE PROCEDURE st_deneme @userid numeric (18) ,@result numeric (18) output AS select * from users return "10" GO **************************** <!--METADATA TYPE="typelib" NAME="Microsoft...
2
by: Yisroel Markov | last post by:
Greetings, In Access 2000, I have a select query where I need to write an expression that will look at a text field and return the third character. (This will be used later in a report based on...
0
by: Ron Vecchi | last post by:
I am using the Select method on a DataTable to return a DataRow filter = (width LIKE '%width=\"%') I am getting an exception saying my filter is invalid I narrowed it down to the part that reads...
4
by: joh12005 | last post by:
Hello, i posted for suggestions a little idea even if it still needs further thoughts but as i'm sure you could help :) if would like to implement some kind of Condition class which i coud...
21
by: Steven T. Hatton | last post by:
I'm trying to improve my formal understanding of C++. One significant part of that effort involves clarifying my understanding of the vocabulary used to describe the language. This is from the...
6
by: rahatekarabhijeet | last post by:
I want regular expression which can extract the data between two symbols, e.g: <*skdjflsk (new line character) lksdjfklasjdfl (new line character) ksjdfkhasdkf (new line character) asdfjkhasdjk...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.